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

Add Visualizer for visualization #341

Merged
merged 16 commits into from
Mar 3, 2022
Merged

Add Visualizer for visualization #341

merged 16 commits into from
Mar 3, 2022

Conversation

zhiqwang
Copy link
Owner

@zhiqwang zhiqwang commented Mar 2, 2022

We can use the Visualizer to display the detections

from torchvision.io import read_image
from yolort.models import yolov5n6
from yolort.utils import Visualizer

model = yolov5n6(pretrained=True, score_thresh=0.45)
model = model.eval()
img_path = "bus.jpg"
preds = model.predict(img_path)

metalabels_path = "coco.names"
image = read_image(img_path)
v = Visualizer(image, metalabels=metalabels_path)
v.draw_instance_predictions(preds[0])
v.imshow(scale=0.5)

Close #227

@zhiqwang zhiqwang added enhancement New feature or request API Library use interface labels Mar 2, 2022
@codecov
Copy link

codecov bot commented Mar 2, 2022

Codecov Report

Merging #341 (9386c16) into main (3a47430) will increase coverage by 0.07%.
The diff coverage is 100.00%.

❗ Current head 9386c16 differs from pull request most recent head 88b830a. Consider uploading reports for the commit 88b830a to get more accurate results

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #341      +/-   ##
==========================================
+ Coverage   95.38%   95.46%   +0.07%     
==========================================
  Files          11       11              
  Lines         759      771      +12     
==========================================
+ Hits          724      736      +12     
  Misses         35       35              
Flag Coverage Δ
unittests 95.46% <100.00%> (+0.07%) ⬆️

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

Impacted Files Coverage Δ
test/test_utils.py 78.18% <100.00%> (+2.67%) ⬆️

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 3a47430...88b830a. Read the comment docs.

@CLAassistant
Copy link

CLAassistant commented Mar 3, 2022

CLA assistant check
All committers have signed the CLA.

Repository owner deleted a comment from CLAassistant Mar 3, 2022
@zhiqwang zhiqwang merged commit de11966 into main Mar 3, 2022
@zhiqwang zhiqwang deleted the add-visualizer branch March 3, 2022 17:36
zhiqwang added a commit that referenced this pull request Mar 8, 2022
* Add Visualizer from detectron2

* Refactor

* Move display into cv2_imshow()

* Use OpenCV to draw bounding boxes

* Cleanup

* Refactor the method in Visualizer

* Fix docstring

* Add metadata attribute in Visualizer

* Fix Visualizer._create_text_labels()

* Apply pre-commit

* Fix Visualizer.overlay_instances()

* Apply pre-commit

* Cleanup

* Add test_visualizer

* Apply pre-commit

* Add Visualizer.imshow()
zhiqwang added a commit that referenced this pull request Mar 8, 2022
* Add Visualizer from detectron2

* Refactor

* Move display into cv2_imshow()

* Use OpenCV to draw bounding boxes

* Cleanup

* Refactor the method in Visualizer

* Fix docstring

* Add metadata attribute in Visualizer

* Fix Visualizer._create_text_labels()

* Apply pre-commit

* Fix Visualizer.overlay_instances()

* Apply pre-commit

* Cleanup

* Add test_visualizer

* Apply pre-commit

* Add Visualizer.imshow()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Library use interface enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add visualizer object
2 participants