Hello,
I would like to use darknet to detect shapes in multiple streams at the same time.
Any idea how to do it ? I can't find a way...
@alxistn Hi,
What do you mean, shapes are objects or something else?
Streams are CUDA-streams or video-streams?
Just run two instances of ./darknet / darknet.exe
I'd like to detect objects on 2 video streams using the same model, loaded only once in the GPU. If I run the executable two times, the model is loaded twice.
How can I change your code to process 2 video streams with only 1 net loaded in the GPU?
There isn't simple way to do this. You should change many places in the source code, to use different instances of network_state structure with the same layer weights.
So your GPU doesn't have enought memory to load two models?
What about if I modify your code to detect single images, then I send with an external code (Python or NodeJS...) to stdin the images from the streams that I want to detect?
Yes, you can try to do this, but how will you get results of detection? You can get result only from stdout (console) in this case.
If you use Darknet as ./darknet detector test... for pack of images, then results will be saved to the jpg-file, showed in the console and showed in the window.
If you use Darknet as ./darknet detector demo... then you can't send images to stdin, but you should send video-file/stream.
I did some modifications to the code in demo.c so it can answer my need. I've deleted some code and rearanged part of the rest of the code, here you will find the bugged version of it: https://github.com/alxistn/darknet
In fact, what I'm trying to do is to be able to read from multiple streams at the same time and run detection for each of these streams.
So I created a structure I called "t_detection" where I put part of the global variables used previously in the demo.c file and I send this structure to the fetch & detect threads so they can work with different set of variables.
You can run the program like I do with the following command line:
./darknet detector demo cfg/obj.data cfg/yolo-obj.cfg yolo.weights -thresh 0.80 'http://192.168.0.1:8080/?action=stream'
The url being the IP camera I read from, and the obj.datam yolo-obj.cfg and yolo.weights being the files I'm using in my detection case but you can use any model to run the code it doesn't really matter.
Can you see where I'm going with that and help me fix the bugs so maybe we could add this to the darknet code base or an alternate version to handle multiple streams detection ?
have you solve the problem? i want to detect objects in more than two video with the same model, what should i do? can you give me some suggest?
Most helpful comment
I did some modifications to the code in demo.c so it can answer my need. I've deleted some code and rearanged part of the rest of the code, here you will find the bugged version of it: https://github.com/alxistn/darknet
In fact, what I'm trying to do is to be able to read from multiple streams at the same time and run detection for each of these streams.
So I created a structure I called "t_detection" where I put part of the global variables used previously in the demo.c file and I send this structure to the fetch & detect threads so they can work with different set of variables.
You can run the program like I do with the following command line:
./darknet detector demo cfg/obj.data cfg/yolo-obj.cfg yolo.weights -thresh 0.80 'http://192.168.0.1:8080/?action=stream'
The url being the IP camera I read from, and the obj.datam yolo-obj.cfg and yolo.weights being the files I'm using in my detection case but you can use any model to run the code it doesn't really matter.
Can you see where I'm going with that and help me fix the bugs so maybe we could add this to the darknet code base or an alternate version to handle multiple streams detection ?