Coder Social home page Coder Social logo

Comments (4)

kasparov92 avatar kasparov92 commented on June 21, 2024 2

@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]

from two-stream-action-recognition.

ice-pice avatar ice-pice commented on June 21, 2024 1

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'))

from two-stream-action-recognition.

ice-pice avatar ice-pice commented on June 21, 2024

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

from two-stream-action-recognition.

kasparov92 avatar kasparov92 commented on June 21, 2024

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

from two-stream-action-recognition.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.