Closed alexandrepossebom closed 4 years ago
Thanks for showing interest in the project and also for the great issue report!
type
is not allowed to be specified under the object_detection
block for a camera. It should be specified in the global domain, so your config needs to be like this:
# See the README for the full list of configuration options.
cameras:
- name: Backyard
host: 192.168.1.50
port: 554
username: admin
password: foobar
path: /cam/realmonitor?channel=4&subtype=0
motion_detection:
interval: 1
trigger: true
object_detection:
interval: 1
labels:
- label: person
confidence: 0.9
- label: dog
confidence: 0.9
- label: car
confidence: 0.9
# MQTT is optional
mqtt:
broker: 192.168.1.100
port: 1883
username: mqtt
password: foobar
object_detection:
type: edgetpu
logging:
level: debug
Let me know if this works out for you. Edit: you can see how the camera object detection and global object detection config differs in the readme
Thank you @roflcoopter for your answer and sorry for my mistake.
Anyway I think x86 dockers machine doesn't have tensor flow.
Look my error now:
[2020-09-10 08:17:04] [lib.detector ] [INFO ] - Initializing detection thread
Traceback (most recent call last):
File "viseron.py", line 163, in <module>
main()
File "viseron.py", line 43, in main
detector = Detector(config)
File "/src/viseron/lib/detector.py", line 20, in __init__
from lib.edgetpu_detection import ObjectDetection
File "/src/viseron/lib/edgetpu_detection.py", line 4, in <module>
import tflite_runtime.interpreter as tflite
ModuleNotFoundError: No module named 'tflite_runtime'
Ahh i see what the error is.
can you run this for me and see if it works?
docker exec -it viseron bash pip3 install https://dl.google.com/coral/python/tflite_runtime-2.1.0.post1-cp37-cp37m-linux_x86_64.whl
If it does i will add it to the image
ERROR: tflite_runtime-2.1.0.post1-cp37-cp37m-linux_x86_64.whl is not a supported wheel on this platform.
Hmm what kind of machine are you running on?
It's a Intel NUC i3
Okey now i get it, the base ubuntu image contains python 3.6 so this would be the correct one.
docker exec -it viseron bash pip3 install https://dl.google.com/coral/python/tflite_runtime-2.1.0.post1-cp36-cp36m-linux_x86_64.whl
Now it's works thank you!
but:
[2020-09-10 11:25:29] [lib.detector ] [INFO ] - Initializing detection thread
Traceback (most recent call last):
File "viseron.py", line 163, in <module>
main()
File "viseron.py", line 43, in main
detector = Detector(config)
File "/src/viseron/lib/detector.py", line 24, in __init__
label_path=self.config.object_detection.label_path,
File "/src/viseron/lib/edgetpu_detection.py", line 13, in __init__
self.labels = self.read_labels(label_path)
File "/src/viseron/lib/edgetpu_detection.py", line 42, in read_labels
labels[int(pair[0])] = pair[1].strip()
IndexError: list index out of range
it looks that the edgetpu labels file is not present in the docker image for NUC. I got a i3 NUC with Coral too.
the labels file should be in the container under /detectors/models/edgetpu/labels.txt
so you need to update your object detection config to this:
object_detection:
type: edgetpu
model_path: /detectors/models/edgetpu/model.tflite
label_path: /detectors/models/edgetpu/labels.txt
The default config isnt smart enough yet to figure out where the model/label file is if you deviate from the default which is darknet
. I will remedy this in the future
Thank you @roflcoopter now it's works.
Great! Closing. Feel free to reopen this or a new issue if you are having trouble
it looks that the edgetpu labels file is not present in the docker image for NUC. I got a i3 NUC with Coral too.
I was missing such file because I was using the roflcoopter/viseron-vaapi:latest
image.
How should I make sure that ffmpeg is using vaapi in the decoding of the h264 image?
UPDATE It looks, in order to make it works, it is enough to add to each camera the parameters:
hwaccel_args:
- -hwaccel
- vaapi
- -hwaccel_device
- /dev/dri/renderD128
- -hwaccel_output_format
- yuv420p
I'm a bit confused by the docker images distinction: the use of vaapi for decoding jointly to Coral EdgeTPU for detection doesn't look to be covered. Furthermore when I tried to use the viseron-vaapi image, I got a message saying that OpenCV was not able to use my GPU for detection.
I will fix so EdgeTPU is fully installed in the VAAPI image, along with models etc. When you run the VAAPI image, it will automatically genereate the proper hwaccel arguments for ffmpeg.
What does your docker run command look like? And what processor do you use?
What does your docker run command look like?
I use docker compose (inside Portainer):
viseron:
container_name: viseron
restart: unless-stopped
network_mode: bridge
privileged: true
#image: roflcoopter/viseron-vaapi:latest
image: roflcoopter/viseron:latest
devices:
- /dev/dri:/dev/dri
volumes:
- /dev/bus/usb:/dev/bus/usb
- /etc/localtime:/etc/localtime:ro
- /srv/docker/viseron/data:/config
- /mnt/cctv/viseron:/recordings
And what processor do you use?
My /proc/cpuinfo
says Intel(R) Core(TM) i3-4150 CPU @ 3.50GHz
.
if you turn on debug logging for the camera, what does the default ffmpeg command look like?
if you turn on debug logging for the camera, what does the default ffmpeg command look like?
Indeed, it looks that the viseron
container activate by default the vaapi con camera decoding:
[2020-09-12 09:59:27] [lib.camera.camera_1 ] [DEBUG ] - FFMPEG decoder command: ffmpeg -hide_banner -loglevel panic -avoid_negative_ts make_zero -fflags nobuffer -flags low_delay -strict experimental -fflags +genpts -stimeout 5000000 -use_wallclock_as_timestamps 1 -vsync 0 -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format yuv420p -rtsp_transport tcp -i rtsp://camera-1.lan:554/h264 -f rawvideo -pix_fmt nv12 pipe:1,
So the above hwaccel_args
should not be necessary, right?
No it shouldnt, however it looks like you still have them in your config as -hwaccel_output_format yuv420p
is not part of the default command
I am trying to take a look at you software but I have a problema with NUC and Coral.
My config:
I am giving this error:
I am running docker using this cmd line :
Thank you in advanced.