Take pictures of a detection and store these pictures (detections)

Hello,
I would like to control an actuator system and take parallel pictures when detecting a model that has already been specially trained. How can I implement this.
For example, the following application would be possible: As soon as a water bottle is visible in the image, take a photo, save this photo and output a signal via an LED. This storing of the photo and the output of the LED signal should take place simultaneously. How can I implement this?

Nvidia Jetson TX2.

Hi markusnvidia,

That project sounds interesting, you will require an inference engine that detects the bottles, then after each detection a signal should be sent to take the snapshot and blink the led.

We have an open source project called GstInference which handles object detection (TinyYOLOV2 and TinyYoloV3). We created a GStreamer plugin that activates signals after each object detected.
This can be modified to exclusively detect bottles.

This is the link to the project’s page: https://developer.ridgerun.com/wiki/index.php?title=GstInference/Introduction

This is an possible implementation for your case.

Greivin F.

Hi,

You can also refer below link in case it helps:

Thanks

Hello,

is there an oppurtunity to take pictures via Python with gstCamera?

Hi,
Please refer below link:
https://github.com/dusty-nv/jetson-inference/blob/master/python/examples/imagenet-camera.py#L51

Thanks

Thanks. But how can I store this image on my drive within the python code?

Hi,

Please refer below link:

Thanks

Thanks, it works.
Now I have the problem that only one picture is saved at a time. Every further image overwrites the already existing one, because I have defined a fixed name for the image. Can I keep the name of the image variable. So if the name already exists, that another file name is chosen?

Thanks.

Yes, that should work. You can even add timestamp to output file name to avoid overwrite issue.

Thanks

How can I add timestamp to output file?

Please refer below links to get some idea:
https://stackoverflow.com/questions/10607688/how-to-create-a-file-name-with-the-current-date-time-in-python
https://stackoverflow.com/questions/5218261/python-how-to-rename-a-text-file-with-datetime/5218328

Thanks

Thanks. It works. I´ve another question.
Is there an oppurtunity to save the coordinates of the detected objects (maybe in a .txt format)?

Hi,

Please refer to below detectNet links:

https://rawgit.com/dusty-nv/jetson-inference/python/docs/html/python/jetson.inference.html#detectNet

Thanks

Thank you. I have trained my own models with DIGITS.
I cannot use them in this code:

net = jetson.inference.detectNet("my-own-model", threshold=0.5)

This is only for pretrained models. How can I use my own model in my “own code”?

Hi,

Please refer to below link:
https://github.com/dusty-nv/jetson-inference/blob/f6171be1c25f239180666bb0e3193831d9a5e923/docs/imagenet-custom.md

Thanks

How can I use my own model in this line?
net = jetson.inference.detectNet(opt.network, sys.argv, opt.threshold)

These are the files, I have in my own created model directory:Screenshot from 2020-04-07 11-46-06

I want to take a photo when I detect an object, how can I do it?

I use docker and my usb camera (/dev/video0)

How do i combine my coding for image detection with led signal?