gianscuri / Action_Recognition_Two_Stream_HMDB51

Action Recognition using a two stream CNN architecture with Frames and Optical Flows. Realized using Keras on HMDB51 dataset.
MIT License
3 stars 2 forks source link

Error when Extracting RGB and flow images #1

Open Gbouna opened 1 year ago

Gbouna commented 1 year ago

Hello, I am trying to replicate your method and i encountered some error when preparing the dataset.

First, i downloaded your extracted raw frames, but after extracting it, it is locked and does not allow me access to the files.

Then i tried extracting the raw frames, but when I run this code to extract the frames, i get the error below data/rawframes&opticalflow_extraction.py

Here is the error message

get videos list done! 
mapping ...
{} read error! 
{} read error! 
{} read error! 
{} read error! 
{} read error! 
{} read error! 
{} read error! 
{} read error! 
{} read error! 
{} read error! 
{} read error! 
{} read error! 
{} read error! 
{} read error! 
{} read error! 
{} read error! 
{} read error! 
{} read error! 
{} read error! 
{} read error! 
{} read error! 
Inizialize capturing of BaseballSwingAnalysis_swing_baseball_f_nm_np1_fr_med_15.avi.
{} read error! 
{} read error! 
multiprocessing.pool.RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/home/arptracker/.local/lib/python3.10/site-packages/skvideo/io/ffmpeg.py", line 276, in _read_frame_data
    assert len(arr) == framesize
AssertionError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/arptracker/Vincent/action_recognition/HMDB-51/Action_Recognition_Two_Stream_HMDB51/rawframes.py", line 70, in dense_flow
    videocapture=skvideo.io.vread(video_path)
  File "/home/arptracker/.local/lib/python3.10/site-packages/skvideo/io/io.py", line 148, in vread
    for idx, frame in enumerate(reader.nextFrame()):
  File "/home/arptracker/.local/lib/python3.10/site-packages/skvideo/io/ffmpeg.py", line 303, in nextFrame
    yield self._readFrame()
  File "/home/arptracker/.local/lib/python3.10/site-packages/skvideo/io/ffmpeg.py", line 287, in _readFrame
    s = self._read_frame_data()
  File "/home/arptracker/.local/lib/python3.10/site-packages/skvideo/io/ffmpeg.py", line 281, in _read_frame_data
    raise RuntimeError("%s" % (err1,))
RuntimeError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/arptracker/anaconda3/lib/python3.10/multiprocessing/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
  File "/home/arptracker/anaconda3/lib/python3.10/multiprocessing/pool.py", line 48, in mapstar
    return list(map(*args))
  File "/home/arptracker/Vincent/action_recognition/HMDB-51/Action_Recognition_Two_Stream_HMDB51/rawframes.py", line 72, in dense_flow
    print('{} read error! ').format(video_name)
AttributeError: 'NoneType' object has no attribute 'format'
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/arptracker/Vincent/action_recognition/HMDB-51/Action_Recognition_Two_Stream_HMDB51/rawframes.py", line 191, in <module>
    pool.map(dense_flow,zip(video_list,flows_dirs,flows_dirs_cls,[step]*len(video_list),[bound]*len(video_list)))
  File "/home/arptracker/anaconda3/lib/python3.10/multiprocessing/pool.py", line 367, in map
    return self._map_async(func, iterable, mapstar, chunksize).get()
  File "/home/arptracker/anaconda3/lib/python3.10/multiprocessing/pool.py", line 774, in get
    raise self._value

I will appreciate if

  1. You can share the link with the extracted raw frames that is not locked or
  2. Help me know how i can address the above error.

Thanks.

gianscuri commented 1 year ago

Hi @Gbouna, I tried re-downloading and extracting the frames and it is not locked, try using 7zip to extract the files.

Regarding the error with the code it seems there are some problems reading the video files, double check that the videos are in the folder ./data/hmdb51/videos.

Let me know if this solves the issue.