You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched the Supervision issues and found no similar bug report.
Bug
I tried loading the DOTAv1 dataset processed by Ultralytics from this URL: https://github.com/ultralytics/assets/releases/download/v0.0.0/DOTAv1.zip with sv.DetectionDataset.from_yolo but it was unsuccessful on Google colab. When I loaded a subset of 100 instances on our compute server, it consumed nearly 36 GB of memory. Free Google colab instance comes with ~12 GB memory only so it was bound to fail there.
I investigated further and found the following reason for the extreme memory usage:
_with_mask function is called at the following position and it sets with_masks argument to True for OBB.
The 2D shape of the mask is the same as the (w, h) resolution of the image. If an image has N detections, the mask shape is (N, w, h), which is not space-friendly.
The size of the mask is the main reason for extreme storage usage.
Search before asking
Bug
I tried loading the DOTAv1 dataset processed by Ultralytics from this URL: https://github.com/ultralytics/assets/releases/download/v0.0.0/DOTAv1.zip with
sv.DetectionDataset.from_yolo
but it was unsuccessful on Google colab. When I loaded a subset of 100 instances on our compute server, it consumed nearly 36 GB of memory. Free Google colab instance comes with ~12 GB memory only so it was bound to fail there.I investigated further and found the following reason for the extreme memory usage:
_with_mask
function is called at the following position and it setswith_masks
argument toTrue
for OBB.supervision/supervision/dataset/formats/yolo.py
Line 175 in 77ae682
with_masks
argument is then passed to the following function with other arguments:supervision/supervision/dataset/formats/yolo.py
Lines 76 to 81 in 77ae682
with_masks
argument, the following lines are executed:supervision/supervision/dataset/formats/yolo.py
Lines 120 to 121 in 77ae682
mask
is the same as the (w, h) resolution of the image. If an image has N detections, themask
shape is (N, w, h), which is not space-friendly.The size of the mask is the main reason for extreme storage usage.
Environment
Google colab:
Minimal Reproducible Example
Colab to reproduce the results.
Additional
I have not taken a deeper look, but a naive solution could be to generate masks only when needed and then discard them for efficient memory usage.
Are you willing to submit a PR?
The text was updated successfully, but these errors were encountered: