dshahrokhian / YOLO_tensorflow

:oncoming_taxi: Object Detection (YOLOv1) implentation in tensorflow, with training, testing and video features.
42 stars 22 forks source link

How do I do it in realtime #5

Open Zumbalamambo opened 7 years ago

Zumbalamambo commented 7 years ago

How do I process it in realtime basis?

Zumbalamambo commented 7 years ago

I got the following error

detection
test/person.jpg 
image
Detect from test/person.jpg 
Traceback (most recent call last):
  File "network/YOLO_small_tf.py", line 513, in <module>
    yolo = YOLO_TF(sys.argv)
  File "network/YOLO_small_tf.py", line 67, in __init__
    self.detect_from_file(self.fromfile)
  File "network/YOLO_small_tf.py", line 241, in detect_from_file
    self.detect_from_cvmat(img)
  File "network/YOLO_small_tf.py", line 179, in detect_from_cvmat
    self.h_img, self.w_img, _ = img.shape
AttributeError: 'NoneType' object has no attribute 'shape'
dshahrokhian commented 7 years ago

Hi,

This code does not have real-time features. The error you are getting is the test image file cannot be found. If you execute the same command while being on the ´network´ folder it works.

Zumbalamambo commented 7 years ago

Thanks it works. is it possible to make it realtime by adding cv2.VideoCapture?

dshahrokhian commented 7 years ago

Yeah, something like that should work.

Zumbalamambo commented 7 years ago

Can you post the code or gist with VideoCapture? Im having hard time while trying to implement it

lionelkusch commented 7 years ago

Can you test this code ? Thank you for the remark of this test

Replace the YOLO_tensorflow/network/YOLO_small_tf.py by this code and run with the next argument : python network/YOLO_small_tf.py -camera "name of input file or id of detection" -tofilevid "name of output file" => argument after camera : filename – name of the opened video file (eg. video.avi) or image sequence (eg. img%02d.jpg, which will read samples like img_00.jpg, img_01.jpg, img_02.jpg, ...) device – id of the opened video capturing device (i.e. a camera index). If there is a single camera connected, just pass 0. the function use for the camera : http://docs.opencv.org/2.4/modules/highgui/doc/reading_and_writing_images_and_video.html YOLO_small_tf.zip

dshahrokhian commented 7 years ago

Sweet. Can you verify that it works, and if that's the case, push the changes to master?

Thanks, Daniyal