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 upstream yolov5 P6 models #196

Merged
merged 49 commits into from
Oct 16, 2021
Merged

Support upstream yolov5 P6 models #196

merged 49 commits into from
Oct 16, 2021

Conversation

zhiqwang
Copy link
Owner

@zhiqwang zhiqwang commented Oct 10, 2021

We use the similar interface to load yolov5 P6 series models, which was first proposed in ultralytics/yolov5#2110 and released in ultralytics/yolov5#2762 , and we also support the latest version as described in ultralytics/yolov5#5141 .

from yolort.models import yolov5s6

# Load model
model = yolov5s6(pretrained=True, score_thresh=0.45)
model.eval()

# Perform inference on an image file
predictions = model.predict("bus.jpg")
# Perform inference on a list of image files
predictions = model.predict(["bus.jpg", "zidane.jpg"])

Note: We haven't added the pertained weights for P6 series models, and we will add these in a follow-up PR. (EDIT: Added in #206)

If you want load the custom checkpoint trained by ultralytics/yolov5, use the following snippets.

from yolort.models import YOLOv5

# 'yolov5s.pt' is downloaded from https://github.com/ultralytics/yolov5/releases/download/v6.0/yolov5s6.pt
ckpt_path_from_ultralytics = "yolov5s6.pt"
model = YOLOv5.load_from_yolov5(ckpt_path_from_ultralytics, version="r6.0")

model.eval()
img_path = "test/assets/bus.jpg"
predictions = model.predict(img_path)

This PR is bc-breaking, we deprecate the update_module_state_from_ultralytics and use load_from_ultralytics instead in ./yolort/utils/update_module_state.py.

https://github.com/zhiqwang/yolov5-rt-stack/blob/4b3454eb10f7cb4ef784036de01d0f79e72bee86/yolort/utils/update_module_state.py#L11-L20

Close #144 .

@zhiqwang zhiqwang added the enhancement New feature or request label Oct 10, 2021
@codecov
Copy link

codecov bot commented Oct 10, 2021

Codecov Report

Merging #196 (233a788) into master (ca3c97c) will increase coverage by 0.34%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #196      +/-   ##
==========================================
+ Coverage   96.49%   96.83%   +0.34%     
==========================================
  Files          10       10              
  Lines         599      601       +2     
==========================================
+ Hits          578      582       +4     
+ Misses         21       19       -2     
Flag Coverage Δ
unittests 96.83% <100.00%> (+0.34%) ⬆️

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

Impacted Files Coverage Δ
test/test_models.py 95.28% <100.00%> (-0.09%) ⬇️
test/test_utils.py 100.00% <100.00%> (+1.58%) ⬆️
test/test_v5.py 100.00% <0.00%> (+6.66%) ⬆️

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 ca3c97c...233a788. Read the comment docs.

@zhiqwang zhiqwang changed the title Support upstream yolov5 v5.0 P6 release Support upstream yolov5 P6 models Oct 11, 2021
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ zhiqwang
❌ pre-commit-ci[bot]
You have signed the CLA already but the status is still pending? Let us recheck it.

@zhiqwang zhiqwang force-pushed the support-v5.0-P6 branch 4 times, most recently from 96097a5 to 9a6f91a Compare October 14, 2021 05:05
@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@zhiqwang zhiqwang added the bc-breaking Backwards Incompatible Changes label Oct 16, 2021
@zhiqwang zhiqwang merged commit 4b3454e into master Oct 16, 2021
@zhiqwang zhiqwang deleted the support-v5.0-P6 branch October 16, 2021 08:51
@zhiqwang zhiqwang added the API Library use interface label Oct 16, 2021
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.

Support YOLOv5 P6 models
2 participants