Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

missing 'frame_count.pickle' #30

Closed
LiJunnan1992 opened this issue Jun 7, 2018 · 4 comments
Closed

missing 'frame_count.pickle' #30

LiJunnan1992 opened this issue Jun 7, 2018 · 4 comments

Comments

@LiJunnan1992
Copy link

LiJunnan1992 commented Jun 7, 2018

No description provided.

@ice-pice
Copy link

Is there a code to directly generate this pickle file or download link?

@ice-pice
Copy link

ice-pice commented Jun 21, 2018

Ok. I got it working. For others, I use the below script.

data_dir = 'ucf_data/jpegs_256/'
all_videos_dir = os.listdir(data_dir);
dic = {};

for curr_video in all_videos_dir:
        num_frames = len(os.listdir(os.path.join(data_dir, curr_video)));
        dic[curr_video] = num_frames-1;
pickle.dump(dic, open('frame_count.pickle','wb'))

@kasparov92
Copy link

This exists in the 'dataloader/dic/' directory in the repo

@kasparov92
Copy link

kasparov92 commented Sep 1, 2018

@ice-pice, the code you have used is wrong, it is needed the number of frames per video-clip and not the number of videos per class. Here is the right code:

inside the spatial_loader.py add the following method before the load_frame_count

def generate_frame_count(self):
    all_videos_dir = os.listdir(self.data_path); 
    dic = {};

    for curr_category in all_videos_dir:
        curr_dir = os.path.join(self.data_path, curr_category)

        for video in  os.listdir(curr_dir):
            num_frames = len(os.listdir(os.path.join(curr_dir, video)));
            dic[video] = num_frames;

def load_frame_count(self):
    #print '==> Loading frame number of each video'
    pickle_path = 'dataloader/dic/frame_count.pickle'
    if not os.path.exists(pickle_path):
        self.generate_frame_count()

    with open(pickle_path,'rb') as file:
        dic_frame = pickle.load(file)
    file.close()

    for line in dic_frame :
        videoname = line.split('_',1)[1].split('.',1)[0]
        n,g = videoname.split('_',1)
        if n == 'HandStandPushups':
            videoname = 'HandstandPushups_'+ g
        self.frame_count[videoname]=dic_frame[line]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants