roflcoopter / viseron

Self-hosted, local only NVR and AI Computer Vision software. With features such as object detection, motion detection, face recognition and more, it gives you the power to keep an eye on your home, office or any other place you want to monitor.
MIT License
1.71k stars 177 forks source link

Latest Yolov4 Models Not Working #300

Closed rogerquake closed 1 year ago

rogerquake commented 2 years ago

I have been trying to load in the latest Yolov4 models below to Viseron for testing and when I do, no objects get detected.

https://github.com/AlexeyAB/darknet/releases/tag/yolov4

The scaled Yolov4 model seems interesting, so was trying to see if that would work.

roflcoopter commented 2 years ago

Great idea, hadn't seen those! I need to upgrade OpenCV for it to work, will do so soon!

rogerquake commented 2 years ago

That would be awesome, thanks! I updated the OpenCV version to the latest release, 4.5.4 in the .env file and compiled the OpenCV docker container from source, but it still didn't work.

roflcoopter commented 2 years ago

Did you also build the main image? They are chained together

rogerquake commented 2 years ago

Yeah, built the OpenCV image followed by the main image. From reading the github threads for OpenCV, it's hard to tell if the required updates are actually in the latest build or not. https://github.com/opencv/opencv/issues/18975

roflcoopter commented 2 years ago

Seems to be in 4.5.4 according to this comment

rogerquake commented 2 years ago

I see this error in the debug log when it attempts to perform object detection with the yolov4-csp weight and cfg:

viseron | Exception in thread object_detection: viseron | Traceback (most recent call last): viseron | File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner viseron | self.run() viseron | File "/usr/lib/python3.8/threading.py", line 870, in run viseron | self._target(*self._args, **self._kwargs) viseron | File "/src/viseron/detector/init.py", line 105, in object_detection viseron | frame_to_scan.frame.objects = self.object_detector.return_objects( viseron | File "/src/viseron/detector/darknet/init.py", line 108, in return_objects viseron | objects = self.post_process(labels, confidences, boxes) viseron | File "/src/viseron/detector/darknet/init.py", line 81, in post_process viseron | self.labels[int(label[0])], viseron | IndexError: invalid index to scalar variable.

roflcoopter commented 2 years ago

Seems the code has to change as well, see here

Not sure how to apply it right now tho but i will get to it soon!

ozett commented 2 years ago

let us know if when can try yolo4...

roflcoopter commented 2 years ago

Will be in #306 when its done

ozett commented 2 years ago

i will follow the progess on https://github.com/roflcoopter/viseron/pull/306 thanks for notifying here 🤝

roflcoopter commented 1 year ago

YOLOv4 and even YOLOv7 is available in v2