facebookarchive / C3D

C3D is a modified version of BVLC caffe to support 3D ConvNets.
Other
1.16k stars 507 forks source link

Check failed: end_frm <= num_of_frames (225 vs. 224) #266

Closed huangh12 closed 7 years ago

huangh12 commented 7 years ago

Hello, I've compiled the C3D1.1 and try to run feature_extraction.sh in the directory c3d_ucf101_feature_extraction. After changing the video_data_param from use_image: true to use_image: false in the prototxt to enable the net to accept video input rather image frame directly (because I didn't transform ucf101 into images), I got the error below:


I0514 18:46:51.669786  3131 net.cpp:242] This network produces output accuracy/top-1
I0514 18:46:51.669788  3131 net.cpp:242] This network produces output accuracy/top-5
I0514 18:46:51.669790  3131 net.cpp:242] This network produces output loss
I0514 18:46:51.669843  3131 net.cpp:255] Network initialization done.
I0514 18:46:52.283429  3131 upgrade_proto.cpp:77] Attempting to upgrade batch norm layers using deprecated params: c3d_resnet18_sports1m_r2_iter_2800000.caffemodel
I0514 18:46:52.283464  3131 upgrade_proto.cpp:80] Successfully upgraded batch norm layers using deprecated params.
I0514 18:46:52.310569  3131 extract_image_features.cpp:96] Extracting features for 4970 batches
I0514 18:46:52.310638  3131 blocking_queue.cpp:49] Waiting for data
I0514 18:46:55.020273  3131 extract_image_features.cpp:130] Extracted features of 30 images.
F0514 18:47:43.193099  3158 image_io.cpp:175] Check failed: end_frm <= num_of_frames (225 vs. 224) end frame must be less or equal to num of frames
*** Check failure stack trace: ***
    @     0x7fb4bb3405cd  google::LogMessage::Fail()
    @     0x7fb4bb342433  google::LogMessage::SendToLog()
    @     0x7fb4bb34015b  google::LogMessage::Flush()
    @     0x7fb4bb342e1e  google::LogMessageFatal::~LogMessageFatal()
    @     0x7fb4bb89d6c5  caffe::ReadVideoToVolumeDatumHelper()
    @     0x7fb4bb89e6ec  caffe::ReadVideoToVolumeDatum()
    @     0x7fb4bb839758  caffe::VideoDataLayer<>::load_batch()
    @     0x7fb4bb72a877  caffe::BasePrefetchingDataLayer<>::InternalThreadEntry()
    @     0x7fb4bb70ab45  caffe::InternalThread::entry()
    @     0x7fb4bb70ba6e  boost::detail::thread_data<>::run()
    @     0x7fb4af4ed5d5  (unknown)
    @     0x7fb4ae5c16ba  start_thread
    @     0x7fb4baada82d  clone
    @              (nil)  (unknown)

Did I miss something? Could anyone help? Thank you very much!


PS: When I refer to image_io.cp to find the corresponding line that raised error, I somewhat think there may be some bug in the code... See codes below please,

    int end_frm = use_start_frm + length * sampling_rate;
    CHECK_LE(end_frm, num_of_frames) << "end frame must be less or equal to num of frames";

    for (int i=use_start_frm; i<end_frm; i++){
        if (sampling_rate > 1) {
            // If sampling_rate > 1, purposely keep some frames
            if ((i-use_start_frm) % sampling_rate !=0) {
                cap.read(img_origin);
                continue;
            }
        }

Apparently, in the for loop, the program never read the end_frm-th frame, instead the (end_frm-1)-th frame is the final frame being read in a loop. So, the line "CHECK_LE(end_frm, num_of_frames)" is too strict. Since the the program can only read as far as the (end_frm-1)-th frame, it will be more appropriate to write "CHECK_LE(end_frm-1, num_of_frames)". This will make the final frame of each video reachable to the program.

Am I right?


Appended: However, change the end_frm into end_frm-1, make clean, and make all, rerun the shell script, it helps nothing... error still exists

I checked the problem video which is given as

/DataSet/UCF101/UCF-101/ApplyEyeMakeup/v_ApplyEyeMakeup_g09_c04.avi 177 0

in the file ucf101_video_frame.list. I write a python script to read the v_ApplyEyeMakeup_g09_c04.avi using opencv and output the number of total frames. The number is 191. That's to say, it's impossible to start at the frame 177 as ucf101_video_frame.list gives since 177+15 already surpass 191.

Now, I want to ask, are we using the same ucf101 dataset ??

Looking forward to some help..

dutran commented 7 years ago

Video data layer has a minor difference for input_frame and input_video. For video, frame index starts at 0, for frame, index start at 1.

dutran commented 7 years ago

Just make sure the input frames/videos have enough frames for the video_data_layer to read.