Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support loading model weight from ultralytics #167

Merged
merged 30 commits into from
Sep 21, 2021
Merged

Conversation

zhiqwang
Copy link
Owner

@zhiqwang zhiqwang commented Sep 17, 2021

We introduce a new interface to load models from ultralytics/yolov5

from yolort.models import yolov5s

# the following 'yolov5s.pt' is downloaded from https://github.com/ultralytics/yolov5/releases/download/v4.0/yolov5s.pt
ckpt_path_from_ultralytics = 'yolov5s.pt'
model = yolov5s(score_thresh=0.25)
model.load_from_yolov5(ckpt_path_from_ultralytics)

model.eval()
img_path = 'test/assets/bus.jpg'
results = model.predict(img_path)

Resolves #141 .


NOTE: This PR will introduce BC-breaking changes, we're moving the common utils to yolort.v5, such as

https://github.com/zhiqwang/yolov5-rt-stack/blob/845d1b2b8ef7805492c7364ebdd72952efd89b4a/yolort/models/path_aggregation_network.py#L7

https://github.com/zhiqwang/yolov5-rt-stack/blob/845d1b2b8ef7805492c7364ebdd72952efd89b4a/yolort/models/darknet.py#L8

@zhiqwang zhiqwang added the enhancement New feature or request label Sep 17, 2021
@codecov
Copy link

codecov bot commented Sep 17, 2021

Codecov Report

Merging #167 (348f053) into master (b9c6720) will decrease coverage by 0.09%.
The diff coverage is 95.74%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #167      +/-   ##
==========================================
- Coverage   96.25%   96.16%   -0.10%     
==========================================
  Files          11       10       -1     
  Lines         561      600      +39     
==========================================
+ Hits          540      577      +37     
- Misses         21       23       +2     
Flag Coverage Δ
unittests 96.16% <95.74%> (-0.10%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
test/test_v5.py 87.50% <87.50%> (ø)
test/test_utils.py 96.82% <95.65%> (+7.93%) ⬆️
test/test_data_pipeline.py 100.00% <100.00%> (ø)
test/test_models.py 95.37% <100.00%> (+0.49%) ⬆️
test/test_models_anchor_utils.py 100.00% <100.00%> (ø)
test/test_models_common.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b9c6720...348f053. Read the comment docs.

@zhiqwang zhiqwang added the bc-breaking Backwards Incompatible Changes label Sep 17, 2021
@zhiqwang zhiqwang force-pushed the load-from-ultralytics branch from 37e4eb3 to ea81728 Compare September 19, 2021 09:26
@zhiqwang zhiqwang force-pushed the load-from-ultralytics branch from 518aa0f to f1276a0 Compare September 19, 2021 18:21
@zhiqwang zhiqwang added the API Library use interface label Sep 20, 2021
@zhiqwang zhiqwang force-pushed the load-from-ultralytics branch from 94c89bb to 3698657 Compare September 21, 2021 07:00
@zhiqwang zhiqwang force-pushed the load-from-ultralytics branch from 96d06d3 to 0d0b5f1 Compare September 21, 2021 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Library use interface bc-breaking Backwards Incompatible Changes enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error on converting a custom yolov5s to yolort
1 participant