-
Notifications
You must be signed in to change notification settings - Fork 379
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
[Enhancement] Provide OpenCV
backend for visualizer
#1142
base: main
Are you sure you want to change the base?
[Enhancement] Provide OpenCV
backend for visualizer
#1142
Conversation
Hi! Is this PR ready for review? It remains a draft. |
Hi @HAOCHENYE , two functions are left to be implemented, I will issue a PR soon. |
Hi @HAOCHENYE, I have issued the PR, please review. Thanks! |
OpenCV
backend for visualizer
Hi, we should provide the OpenCV backend for mmengine/mmengine/visualization/visualizer.py Line 228 in 4bc2fe1
Although there will be a lot of |
Hi @HAOCHENYE, I have made the necessary changes, please review. Thanks! |
Hi @HAOCHENYE, I have made the suggested changes, please review. Thanks! |
Hi, you can update the unittest in from parameterized import parameterized
...
@parameterized.expand([['cv2'], ['matplotlib']])
def test_draw_bboxes(self, backend):
visualizer = Visualizer(image=self.image)
# only support 4 or nx4 tensor and numpy
visualizer.draw_bboxes(torch.tensor([1, 1, 2, 2]), backend=backend)
# valid bbox
visualizer.draw_bboxes(torch.tensor([1, 1, 1, 2]), backend=backend)
bboxes = torch.tensor([[1, 1, 2, 2], [1, 2, 2, 2.5]])
visualizer.draw_bboxes(
bboxes, alpha=0.5, edge_colors=(255, 0, 0), line_styles='-', backend=backend)
bboxes = bboxes.numpy()
visualizer.draw_bboxes(bboxes, backend=backend)
# test invalid bbox
with pytest.raises(AssertionError):
# x1 > x2
visualizer.draw_bboxes(torch.tensor([5, 1, 2, 2]))
# test out of bounds
with pytest.warns(
UserWarning,
match='Warning: The bbox is out of bounds,'
' the drawn bbox may not be in the image'):
visualizer.draw_bboxes(torch.tensor([1, 1, 20, 2]))
# test incorrect bbox format
with pytest.raises(TypeError):
visualizer.draw_bboxes([1, 1, 2, 2]) I get some unexpected error when updating the unit test. |
Hi @HAOCHENYE, I have updated the tests, please review. Thanks! |
Hi @HAOCHENYE, is there anything else which needs to be done for this PR? Can you please elaborate? |
|
#1101