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

187 - Optimize pytorch weight loading on startup + dependencies update #193

Merged
merged 3 commits into from
Mar 5, 2024

Conversation

MaxJa4
Copy link
Collaborator

@MaxJa4 MaxJa4 commented Feb 3, 2024

Description

Fixes PyTorch auto-downloading models on node-start even if its not used (causes significant delay until ready to process).
Dependencies updated to fix building issues (b5 update) and have newest versions of PyTorch/Ultralytics and other libraries.

Fixes #187

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings

@MaxJa4 MaxJa4 added bug Something isn't working perception labels Feb 3, 2024
@MaxJa4 MaxJa4 self-assigned this Feb 3, 2024
@MaxJa4
Copy link
Collaborator Author

MaxJa4 commented Feb 3, 2024

Delay reduced to ~0.5s on my machine. Won't be at university until Thursday due to work - would appreciate a quick test of this fix on the lab PCs to see if it works :) Thanks

@samuelkuehnel
Copy link
Collaborator

Here is a short video from the delay, it is about 1-2 seconds when looking at the ros time.
delay.webm

@MaxJa4
Copy link
Collaborator Author

MaxJa4 commented Feb 5, 2024

@samuelkuehnel Thanks for testing. I saw that with the recent additions in the VisionNode by the LIDAR/distance features by Leon, the overall calculation time increased. It's ~50ms (20 FPS) on my PC, looks like it's more like 200ms on the lab PCs. I can try to check if I can do anything to fix this in the VisionNode without breaking the distance/LIDAR stuff, but I doubt it.

@MaxJa4
Copy link
Collaborator Author

MaxJa4 commented Feb 12, 2024

Added further measures to ensure up-to-date classification data:

  • Traffic light detection is handled asynchronously now (-> independent of distance calculation)
  • Switch to second best classification model (YOLO RTDETR-L instead of RTDETR-X) which ~54% faster with only slightly worse accuracy according to Ultralytics

Overall, the timings of the VisionNode changed like this (tested on a 4070 Ti):

Before:

  • Classification: ~50ms
  • Traffic light detection & distance calc: ~22ms
  • Total: ~72ms -> 13.9 FPS

Now:

  • Classification: ~40ms
  • Traffic light detection: asynchronously now, doesn't wait for distance calc
  • Distance calc: ~15ms
  • Total: ~60ms -> 16.7 FPS

Using the NAS models was not possible because of (hours of) dependency hell with Ultralytics + Super-Gradients... also converting the RT-DETR model to a way faster format like TensorRT is not loadable with Ultralytics.

Dependencies changed, please run b5 update! :)

@MaxJa4
Copy link
Collaborator Author

MaxJa4 commented Feb 28, 2024

5 days ago, a new/improved version of the standard YOLO model has been released: https://github.com/WongKinYiu/yolov9
This may be a candidate to try if the above changes are not sufficient performance wise.

@samuelkuehnel samuelkuehnel merged commit fa7b8b6 into main Mar 5, 2024
2 of 3 checks passed
@MaxJa4 MaxJa4 deleted the 187-fix-vision-node-delay branch March 5, 2024 18:38
@MaxJa4 MaxJa4 mentioned this pull request Mar 9, 2024
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working perception
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Fix VisionNode delay in leaderboard
2 participants