AlexeyAB / darknet

YOLOv4 / Scaled-YOLOv4 / YOLO - Neural Networks for Object Detection (Windows and Linux version of Darknet )
http://pjreddie.com/darknet/
Other
21.71k stars 7.96k forks source link

Test on video #612

Open ant1pink opened 6 years ago

ant1pink commented 6 years ago

Hi guys,

Is there a way to test on video rather than video stream?

Thanks,

TheMikeyR commented 6 years ago

./darknet detector demo ./cfg/coco.data ./cfg/yolov2.cfg ./yolov2.weights videofile.mp4 -i 0 -thresh 0.25

ant1pink commented 6 years ago

@TheMikeyR Thanks. I tried, but I got the error “Demo needs OpenCV for webcam images”. And I tried to make with OpenCV =1, then I got "fatal error: opencv2/opencv.hpp: No such file or directory." I install OpenCV with pip install, how should I set the path?

Many thanks,

ant1pink commented 6 years ago

I find opencv.c and put the path in .bashrc, but I got a new error. g++ -DOPENCV pkg-config --cflags opencv -DGPU -I/usr/local/cuda-8.0/include/ -DCUDNN -Wall -Wfatal-errors -ffp-contract=fast -mavx -Ofast -DOPENCV -DGPU -DCUDNN -I/usr/local/cudnn-8.0/include obj/http_stream.o obj/gemm.o obj/utils.o obj/cuda.o obj/convolutional_layer.o obj/list.o obj/image.o obj/activations.o obj/im2col.o obj/col2im.o obj/blas.o obj/crop_layer.o obj/dropout_layer.o obj/maxpool_layer.o obj/softmax_layer.o obj/data.o obj/matrix.o obj/network.o obj/connected_layer.o obj/cost_layer.o obj/parser.o obj/option_list.o obj/darknet.o obj/detection_layer.o obj/captcha.o obj/route_layer.o obj/writing.o obj/box.o obj/nightmare.o obj/normalization_layer.o obj/avgpool_layer.o obj/coco.o obj/dice.o obj/yolo.o obj/detector.o obj/layer.o obj/compare.o obj/classifier.o obj/local_layer.o obj/swag.o obj/shortcut_layer.o obj/activation_layer.o obj/rnn_layer.o obj/gru_layer.o obj/rnn.o obj/rnn_vid.o obj/crnn_layer.o obj/demo.o obj/tag.o obj/cifar.o obj/go.o obj/batchnorm_layer.o obj/art.o obj/region_layer.o obj/reorg_layer.o obj/reorg_old_layer.o obj/super.o obj/voxel.o obj/tree.o obj/yolo_layer.o obj/upsample_layer.o obj/convolutional_kernels.o obj/activation_kernels.o obj/im2col_kernels.o obj/col2im_kernels.o obj/blas_kernels.o obj/crop_layer_kernels.o obj/dropout_layer_kernels.o obj/maxpool_layer_kernels.o obj/network_kernels.o obj/avgpool_layer_kernels.o -o darknet -lm -pthread pkg-config --libs opencv -L/usr/local/cuda-8.0/lib64 -lcuda -lcudart -lcublas -lcurand -L/usr/local/cudnn-8.0/lib64 -lcudnn -lstdc++ /usr/bin/ld: cannot find -lippicv collect2: error: ld returned 1 exit status Makefile:110: recipe for target 'darknet' failed make: *** [darknet] Error 1

TheMikeyR commented 6 years ago

You should compile opencv from source, you can e.g. follow this guide I have installed it without a virtual environment though.

ant1pink commented 6 years ago

@TheMikeyR Alright, I will have a try. At the moment, it works on official darknet but not this version.

AshleyRoth commented 6 years ago

@TheMikeyR Hi! can you explain me what does mean -i 0 here --> ./darknet detector demo ./cfg/coco.data ./cfg/yolov2.cfg ./yolov2.weights videofile.mp4 -i 0 -thresh 0.25

ant1pink commented 6 years ago

@AshleyRoth -i 0 equal to -gpu 0, if you have multiple you can use -gpu 0,1,2...

ant1pink commented 6 years ago

@TheMikeyR Can we test the video on multiple GPUs?

AlexeyAB commented 6 years ago

@ant1pink You can't test 1 video on multiple GPU. You can only train on multiple GPU.

ant1pink commented 6 years ago

@AlexeyAB Okay, thanks very much. One more question, I followed your suggestion here to save the demo video. When I change GPU from K80 to P100, the FPS increased from 6. to 25., however the FPS didn't change in the saved video.

AlexeyAB commented 6 years ago

@ant1pink This is done to avoid slowing the result videofile on slow GPU.