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

Augmentation SpeedUp #147

Merged
merged 15 commits into from
Aug 15, 2024
Merged

Augmentation SpeedUp #147

merged 15 commits into from
Aug 15, 2024

Conversation

sokovninn
Copy link
Member

@sokovninn sokovninn commented Aug 15, 2024

This PR includes:

Performance Comparison

Measured on Quadro RTX4000 (8 GB GPU memory), CUDA 11.7, 8 CPU, 32GB RAM.

Params:
dataset: COCO train split
batch_size: 16
num_workers: 4 (available with Remove num_workers Hotfix)
augs: normalization + mosaic
model: yolov6n
img_size: 416x416

Version Time (minutes)
Unoptimized (workers=0) 117
Optimized 15 🔥

@sokovninn sokovninn added the data Changes affecting luxonis_ml.data subpackage label Aug 15, 2024
@sokovninn sokovninn self-assigned this Aug 15, 2024
@kozlov721 kozlov721 changed the title Fix/augmentation speedup order Augmentation SpeedUp Aug 15, 2024
@JSabadin
Copy link
Contributor

JSabadin commented Aug 15, 2024

I also conducted experiments to compare the performance of YOLOv6/YOLOv8 nano models with ours under the same settings and observed slightly longer timings. It took 18 minutes for our model and 21 minutes for the YOLOv6 and YOLOv8 models.

Additionally, note that previously, an epoch without the polars library, load speedup, and augmentation fixes lasted ~5 hours on GCP. Reducing the time to ~15 minutes represents a very significant speedup.

Copy link

github-actions bot commented Aug 15, 2024

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
3581 2994 84% 0% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
luxonis_ml/data/augmentations/utils.py 97% 🟢
TOTAL 97% 🟢

updated for commit: 8124c29 by action🐍

@kozlov721 kozlov721 added the enhancement New feature or request label Aug 15, 2024
"keypoints_visibility_batch": keypoints_visibility_batch,
"keypoints_classes_batch": keypoints_classes_batch,
}
if return_mask:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we see any concerns with mask_batch missing downstream? Would it be safer to keep it in dict but have it as an empty value?

Copy link
Contributor

@JSabadin JSabadin Aug 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, the augmentations will still work if mask_batch is simply missing. I think it does not pose any threat.

Additionally, if we simply enter an empty value for masks instead of adding it when necessary, it fails.
It cannot be empty; it would have to contain zeros, but this is slow because augmentations are then applied to that dummy mask. This is what we were doing before, and it was slowing the code down

Moreover, using dummy keypoints (just one keypoint at x:0, y:0) or bounding boxes does not affect the time it takes to apply the augmentations.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CC: @JSabadin

Copy link

Test Results

  1 files    1 suites   19m 14s ⏱️
 98 tests  98 ✅ 0 💤 0 ❌
110 runs  110 ✅ 0 💤 0 ❌

Results for commit 8124c29.

@sokovninn sokovninn merged commit d996b67 into dev Aug 15, 2024
12 checks passed
@kozlov721 kozlov721 mentioned this pull request Aug 16, 2024
kozlov721 added a commit that referenced this pull request Aug 19, 2024
Co-authored-by: Jernej Sabadin <[email protected]>
Co-authored-by: Martin Kozlovsky <[email protected]>
kozlov721 added a commit that referenced this pull request Aug 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
data Changes affecting luxonis_ml.data subpackage enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants