alicevision / CCTag

Detection of CCTag markers made up of concentric circles.
https://cctag.readthedocs.io
Mozilla Public License 2.0
358 stars 89 forks source link

Tag detection is very slow (CUDA 11.1, Windows 10) #172

Closed antithing closed 2 years ago

antithing commented 3 years ago

I have this code built under windows, with CUDA 11.1. The lib compiles, and so does teh 'detection' application.

When i run the detection on the sample image using:

detection -n 3 -i sample/01.png

It finds the markers and displays them, but it takes:

Total time: 5.103234s wall, 5.218750s user + 0.000000s system = 5.218750s CPU (102.3%)

more than five seconds! is this expected? I am looking to run this code in realtime (50fps)

Am i doing something wrong? Can i speed up the tag detection?

Thank you.

simogasp commented 3 years ago

try detection -n 3 -i sample/01.png --use-cuda see here https://github.com/alicevision/CCTag/blob/develop/src/applications/detection/CmdLine.cpp#L44

antithing commented 3 years ago

Ah thank you! This has it running at around 130ms for the sample image, on a GTX 1080.

Aside from resizing the image, is there any other tweaks to make to speed up the functions?

Thanks again!

simogasp commented 3 years ago

try with a video, because on a single image there might be some overheads involved I guess

antithing commented 3 years ago

Okay thanks, i will try it.

Just so i hav realistic expectations, what is the top speed of this code, roughly, at 1920 x 1080 image size?

simogasp commented 3 years ago

normally it should be real-time with FullHD videos

antithing commented 3 years ago

Hi again, I am testing with a video file (1920 x 1080) with three markers visible. Using CUDA, on a GTX 1080 card, I still see slow frame times (150 - 230 ms)

The log is:

`#frame 333 Detected 5 candidates 660.546 667.647 0 1 1003.29 682.542 9 1 1354.46 698.786 14 1 1354.4 698.556 14 -4 1354.6 698.46 14 -4

3 markers detected and identified Times passed in milliseconds: 213.893 Loading image 334 into TagPipe 0 D:\Markers\CCTag\CCTag-develop\src\cctag\Detection.cpp:861 Found more than 60 (62) markers D:/Markers/CCTag/CCTag-develop/src/./cctag/cuda/pinned_counters.cu:134 called from D:\Markers\CCTag\CCTag-develop\src\cctag\CCTag.cpp:109 Hard-coded number of Nearyby Points in pinned memory is too small. Increase and recompile. D:/Markers/CCTag/CCTag-develop/src/./cctag/cuda/pinned_counters.cu:134 called from D:\Markers\CCTag\CCTag-develop\src\cctag\CCTag.cpp:109 Hard-coded number of Nearyby Points in pinned memory is too small. Increase and recompile.

==== Uploading 62 tags ==== Total time: 0.197040s wall, 0.468750s user + 0.062500s system = 0.531250s CPU (269.6%)`

Is there anything I can do to speed this up? I am aiming for 60fps...

Thank you!

github-actions[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.