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

Run project without copying videos? #124

Open
SusanL82 opened this issue Sep 12, 2023 · 1 comment
Open

Run project without copying videos? #124

SusanL82 opened this issue Sep 12, 2023 · 1 comment

Comments

@SusanL82
Copy link

Hi VAME team,

I am planning to run VAME on a pretty big group of videos and I was wondering if it is possible to do this without having to copy all of the videos to the VAME project folder (I am running into some space issues).
Is there some way to enter a path for the videos directly? I will have a look through the functions themselves soon, but if not copying is completely impossible, you can maybe save me the trouble.

Best,
Susan

@aredwine3
Copy link

@SusanL82 check my comments on issue #127

I think that could help you out! I have additionally edited the 'create_trainset' to allow you to enter your own list of video file path names to create a training data of specific videos. This should work without copying them into the vame video folder but I have not tested that:

def create_trainset(config, check_parameter=False, data_fraction=None):
    config_file = Path(config).resolve()
    cfg = read_config(config_file)
    legacy = cfg['legacy']
    fixed = cfg['egocentric_data']
    
    if not os.path.exists(os.path.join(cfg['project_path'],'data','train',"")):
        os.mkdir(os.path.join(cfg['project_path'],'data','train',""))

    files = []
    if cfg['all_data'] == 'No':
        for file in cfg['video_sets']:
            use_list = input("Do you have a list of videos you want to use for training? yes/no: ")
            if use_list == 'yes':
                files_input = input("Please enter the list of videos you want to use for training: ")
                files = [clean_input(f) for f in files_input.split(',')]
                break
            elif use_list == 'no':
                use_file = input("Do you want to train on " + file + "? yes/no: ")
                if use_file == 'yes':
                    files.append(file)
                if use_file == 'no':
                    continue
            else:
                print("Invalid input. Please enter 'yes' or 'no'.")
    else:
        for file in cfg['video_sets']:
            files.append(file)

    print("Creating training dataset...")
    if cfg['robust'] == True:
        print("Using robust setting to eliminate outliers! IQR factor: %d" %cfg['iqr_factor'])
        
    if fixed == False:
        if data_fraction == None:
            print("Creating trainset from the vame.egocentrical_alignment() output ")
            traindata_aligned(cfg, files, cfg['test_fraction'], cfg['num_features'], cfg['savgol_filter'], check_parameter)
        elif data_fraction != None:
            print("Creating trainset from the vame.egocentrical_alignment() output ")
            traindata_aligned_fractional(cfg, files, cfg['test_fraction'], cfg['num_features'], cfg['savgol_filter'], check_parameter, data_fraction)
    else:
        print("Creating trainset from the vame.csv_to_numpy() output ")
        traindata_fixed(cfg, files, cfg['test_fraction'], cfg['num_features'], cfg['savgol_filter'], check_parameter)
    
    if check_parameter == False:
        print("A training and test set has been created. Next step: vame.train_model()")
        

Just copy this function in place of the original 'def create_trainset' at the bottom of the file vame/model/create_training.py.

Let me know if you run into any issues or have questions!

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

2 participants