microsoft / CameraTraps

PyTorch Wildlife: a Collaborative Deep Learning Framework for Conservation.
https://cameratraps.readthedocs.io/en/latest/
MIT License
781 stars 246 forks source link

api/synchronous without GPU #342

Closed PentamapRainer closed 1 year ago

PentamapRainer commented 1 year ago

Is it possible to install api/synchronous without having a GPU server?

agentmorris commented 1 year ago

Yes, the code in the api/synchronous folder will work with or without a GPU. The setup process is the same with or without a GPU; the only difference is that in the last step ("Run the Docker image"), you would run nvidia-docker if you have a GPU, or plain-old-just-docker docker if you don't have a GPU.

Hope that helps!

PentamapRainer commented 1 year ago

Hi Dan!

Yes, the code in the api/synchronous folder will work with or without a GPU. The setup process is the same with or without a GPU; the only difference is that in the last step ("Run the Docker image https://github.com/microsoft/CameraTraps/tree/main/api/synchronous#run-the-docker-image"), you would run nvidia-docker if you have a GPU, or plain-old-just-docker docker if you don't have a GPU.

Thanks for that very fast response.

The first step in you tutorial at https://github.com/microsoft/CameraTraps/tree/main/api/synchronous https://github.com/microsoft/CameraTraps/tree/main/api/synchronous is the installation of nvidia-docker. This I would have to replace with the installation of „plain-old-just-docker docker“, wright?

All other steps will remain the same, wright?

Thanks for reaching out. You don't need a GPU to run anything in our repo, though obviously everything will run faster with a GPU. A good ballpark is that you can process around 30k-50k images per day through MegaDetector v5 on a relatively modern CPU, and anywhere from 250,000 to 1M images per day on a relatively modern GPU. We have some benchmarks here https://github.com/microsoft/CameraTraps/blob/main/megadetector.md#timing-results-for-mdv5.

We just have 300-500 images a day. So the performance is not that crucial for our application.

Hope that helps!

Thanks a lot for your help.

Kind regards Rainer Prüller

DR. RAINER PRÜLLER Managing Director

pentamap GmbH Petersbachstraße 28/6, A-8042 Graz

+43 650 2666693 www.pentamap.com https://www.pentamap.com/

Am 26.04.2023 um 17:12 schrieb Dan Morris @.***>:

Yes, the code in the api/synchronous folder will work with or without a GPU. The setup process is the same with or without a GPU; the only difference is that in the last step ("Run the Docker image https://github.com/microsoft/CameraTraps/tree/main/api/synchronous#run-the-docker-image"), you would run nvidia-docker if you have a GPU, or plain-old-just-docker docker if you don't have a GPU.

Hope that helps!

— Reply to this email directly, view it on GitHub https://github.com/microsoft/CameraTraps/issues/342#issuecomment-1523592085, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABUCN7GWNYRD7QLTVEZ6U4TXDE3N5ANCNFSM6AAAAAAXMN55DA. You are receiving this because you authored the thread.

agentmorris commented 1 year ago

Yes, I think you probably want to install Docker rather than nvidia-docker. I'm about 61% sure that you could install nvidia-docker and everything would work fine without a GPU, but it won't do anything useful for you, so, yes, I would just install Docker.

PentamapRainer commented 1 year ago

Dear Dan!

Due to your help I was able to install and run MegaDetector on my server. Thanks a lot for that.

I tested with Postman an got successfully this results:

--6018a6c8840b43aaa69dee4270946f90 Content-Disposition: form-data; name="detection_result"; filename="detection_result" Content-Type: application/json

{"wildkamera-hirsch.jpg": [[0.05833, 0.1015, 0.72083, 0.5718, 0.979, 1]]} --6018a6c8840b43aaa69dee4270946f90--

But I now have problems to interpret these results. What do these numbers mean:

[[0.05833, 0.1015, 0.72083, 0.5718, 0.979, 1]]

Thanks a lot for a short explanation or a link to the documentation.

Kind regards. Rainer

Am 26.04.2023 um 18:07 schrieb Dan Morris @.***>:

Yes, I think you probably want to install Docker rather than nvidia-docker. I'm about 61% sure that you could install nvidia-docker and everything would work fine without a GPU, but it won't do anything useful for you, so, yes, I would just install Docker.

— Reply to this email directly, view it on GitHub https://github.com/microsoft/CameraTraps/issues/342#issuecomment-1523680820, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABUCN7DVYPCRTV5DEXZ6QHDXDFB4XANCNFSM6AAAAAAXMN55DA. You are receiving this because you authored the thread.

agentmorris commented 1 year ago

I'm about 98.7% sure that array will be, for each detection:

[y1, x1, y2, x2, confidence, category]

Where (x1,y1) and (x2,y2) are the upper-left and lower-right coordinates of the bounding box (normalized to the width and height of the image), and category is 1/2/3 for animal/person/vehicle, respectively. So it looks like MegaDetector thinks you have one animal in this image, taking up more or less the upper-left quarter of the image.

Let us know if that doesn't add up, but... I'm 98.7% sure.

PentamapRainer commented 1 year ago

Thanks a lot for your explanation. Your are 100% right👍🏼

PentamapRainer commented 1 year ago

Hi Dan! One more question to the now running MegaDetector service: I can successfully test it with Postman - but I can't access it with PHP-CURL:

$curl = curl_init("server:5050/v1/camera-trap/sync/detect"); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_exec($curl);

Are there any settings have to be made on the server so that I can access it with CURL?

agentmorris commented 1 year ago

Sorry, you've traveled beyond my expertise. If it's working in Postman, this sounds like a PHP/curl question.

Good luck!