DrewNF / Tensorflow_Object_Tracking_Video

Object Tracking in Tensorflow ( Localization Detection Classification ) developed to partecipate to ImageNET VID competition
MIT License
503 stars 198 forks source link

Why I get NAN for df.class_name.max? #13

Open hnyz979 opened 6 years ago

hnyz979 commented 6 years ago

Dear Ferri: Thank you for your codes. I am using Tensorflow with opencv3.3.1, and I changed some of the codes according to the demandas of different opencv versions (for example, cv2.cv.CV_CAP_PROP_FRAME_COUNT is changed to cv2.CV_CAP_PROP_FRAME_COUNT). After these minor changes, the code can be run without errors in my computer. However, the output seems a little strange when I am running VID_yolo.py (the 3rd step in your README.md). The results are as follows: Starting Loading Results [==========================================================] 100% Time: 0:00:00 Finished Loading Results Computing Final Mean Reasults.. Class: nan Max Value: nan Min Value: nan Elapsed Time:6 Seconds Running Completed with Success!!! It is a little confusing why it gives out NANs for I haven't changed any parameters in your code.

Also, although I saw the frames output, it is not quite the same with that in the folder /video_result, and the green bounding box is not seen.

Could you kindly tell me how to solve this problem? many thanks.

DrewNF commented 6 years ago

Good Morning, Sorry for the late response, I'm not mantaining the repo on daily basis. I had the same problem, using the right function and values for opencv gave me many problems! I think that actually is not analizing any frame. That way u receive NaN value.

Bests

AF

niudong1001 commented 6 years ago

Hello , i also got this problem, is there any way to solve it? @DrewNF

DrewNF commented 6 years ago

Could u paste here the error/terminal output with more info? Because the problem depends on different dependencies so I need more insight to try to give u a solution! :) Bests

AF

niudong1001 commented 6 years ago

Hi @DrewNF , sorry for my late response~ When i run python VID_yolo.py --path_video video.mp4, i got my terminal output:

Opening File Video:video.mp4
Opened File Video:video.mp4
Start Reading File Video:video.mp4
8 Frames to Read
[===================================================================] 100% Time: 0:00:00
Finish Reading File Video:video.mp4
Starting DET Phase
Building YOLO_small graph...
    Layer  1 : Type = Conv, Size = 7 * 7, Stride = 2, Filters = 64, Input channels = 3
    Layer  2 : Type = Pool, Size = 2 * 2, Stride = 2
    Layer  3 : Type = Conv, Size = 3 * 3, Stride = 1, Filters = 192, Input channels = 64
    Layer  4 : Type = Pool, Size = 2 * 2, Stride = 2
    Layer  5 : Type = Conv, Size = 1 * 1, Stride = 1, Filters = 128, Input channels = 192
    Layer  6 : Type = Conv, Size = 3 * 3, Stride = 1, Filters = 256, Input channels = 128
    Layer  7 : Type = Conv, Size = 1 * 1, Stride = 1, Filters = 256, Input channels = 256
    Layer  8 : Type = Conv, Size = 3 * 3, Stride = 1, Filters = 512, Input channels = 256
    Layer  9 : Type = Pool, Size = 2 * 2, Stride = 2
    Layer  10 : Type = Conv, Size = 1 * 1, Stride = 1, Filters = 256, Input channels = 512
    Layer  11 : Type = Conv, Size = 3 * 3, Stride = 1, Filters = 512, Input channels = 256
    Layer  12 : Type = Conv, Size = 1 * 1, Stride = 1, Filters = 256, Input channels = 512
    Layer  13 : Type = Conv, Size = 3 * 3, Stride = 1, Filters = 512, Input channels = 256
    Layer  14 : Type = Conv, Size = 1 * 1, Stride = 1, Filters = 256, Input channels = 512
    Layer  15 : Type = Conv, Size = 3 * 3, Stride = 1, Filters = 512, Input channels = 256
    Layer  16 : Type = Conv, Size = 1 * 1, Stride = 1, Filters = 256, Input channels = 512
    Layer  17 : Type = Conv, Size = 3 * 3, Stride = 1, Filters = 512, Input channels = 256
    Layer  18 : Type = Conv, Size = 1 * 1, Stride = 1, Filters = 512, Input channels = 512
    Layer  19 : Type = Conv, Size = 3 * 3, Stride = 1, Filters = 1024, Input channels = 512
    Layer  20 : Type = Pool, Size = 2 * 2, Stride = 2
    Layer  21 : Type = Conv, Size = 1 * 1, Stride = 1, Filters = 512, Input channels = 1024
    Layer  22 : Type = Conv, Size = 3 * 3, Stride = 1, Filters = 1024, Input channels = 512
    Layer  23 : Type = Conv, Size = 1 * 1, Stride = 1, Filters = 512, Input channels = 1024
    Layer  24 : Type = Conv, Size = 3 * 3, Stride = 1, Filters = 1024, Input channels = 512
    Layer  25 : Type = Conv, Size = 3 * 3, Stride = 1, Filters = 1024, Input channels = 1024
    Layer  26 : Type = Conv, Size = 3 * 3, Stride = 2, Filters = 1024, Input channels = 1024
    Layer  27 : Type = Conv, Size = 3 * 3, Stride = 1, Filters = 1024, Input channels = 1024
    Layer  28 : Type = Conv, Size = 3 * 3, Stride = 1, Filters = 1024, Input channels = 1024
    Layer  29 : Type = Full, Hidden = 512, Input dimension = 50176, Flat = 1, Activation = 1
    Layer  30 : Type = Full, Hidden = 4096, Input dimension = 512, Flat = 0, Activation = 1
    Layer  32 : Type = Full, Hidden = 1470, Input dimension = 4096, Flat = 0, Activation = 0
2018-04-08 14:39:17.963536: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
2018-04-08 14:39:17.963559: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
2018-04-08 14:39:17.963567: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
2018-04-08 14:39:17.963574: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations.
2018-04-08 14:39:17.963580: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations.
Loading complete!

8 Frames to DET
[====================================================================================================================================] 100% Time: 0:00:08
det_frames/frame0_det.jpg
Start Making File Video:output.mp4
8 Frames to Compress
[====================================================================================================================================] 100% Time: 0:00:00
Finished Making File Video:output.mp4
Starting Loading Results
[====================================================================================================================================] 100% Time: 0:00:00
Finished Loading Results
Computing Final Mean Reasults..
Class: nan
Max Value: nan
Min Value: nan
Elapsed Time:12 Seconds
Running Completed with Success!!!

Hope to find a solution~

DrewNF commented 6 years ago

First time I saw this output! I think is something related to Tensorflow as u see in the output there are some libraries not well binded.

U adapted the code or are you doing just run tests??

Best

AF

niudong1001 commented 6 years ago

Hello @DrewNF , i didn't change the code and just run tests. I use conda to manage my python packages and here is my environment:

opencv 2.4.11
python  2.7.14
tensorflow  1.1.0

Hope it maybe helpful~

zouying-sjtu commented 5 years ago

pypi has removed opencv-python==2.4.11 , so how to build a virtualenv to run this code?