Blenderproc: how to run the program several times with a different config file for each execution

Created on 19 Dec 2020  路  3Comments  路  Source: DLR-RM/BlenderProc

hi, i need help please, i want to generate a dataset from several config files, how to do that automatically

example :

if I read a file which contains all the config.yaml files and from this script I run run several times

import yaml
import os
new_list = []
for root, dirs, files in os.walk("output"):

for file in files:

#if file.endswith(".yaml"):
####with open(os.path.join(root, file), 'r') as f:
##########data = yaml.safe_load(f)
##########new_list.append(data)

print (new_list)

thank you

Most helpful comment

@Lotfi-MERAD One thing that you can do is to run the BlenderProc pipeline individually for each of the config files instead of concatenating them. Maybe the code below works for your use case (if not just let me know).

Don't forget to change the variables DATASET_PATH and OUTPUT_PATH. Also, the arguments for the run.py might be different depending on which BlenderProc example you want to run. Don't forget to change those as well.

import yaml
import os
import subprocess

DATASET_PATH = "DATASET_PATH"
OUTPUT_PATH = "OUTPUT_PATH"

for root, dirs, files in os.walk("output"):
    for file_ in files:
        if file_.endswith(".yaml"):
            # Assuming your present working directory is BlenderProc repo
            subprocess.call(["python", "run.py", file_, DATASET_PATH, OUTPUT_PATH], shell=False)

All 3 comments

@Lotfi-MERAD One thing that you can do is to run the BlenderProc pipeline individually for each of the config files instead of concatenating them. Maybe the code below works for your use case (if not just let me know).

Don't forget to change the variables DATASET_PATH and OUTPUT_PATH. Also, the arguments for the run.py might be different depending on which BlenderProc example you want to run. Don't forget to change those as well.

import yaml
import os
import subprocess

DATASET_PATH = "DATASET_PATH"
OUTPUT_PATH = "OUTPUT_PATH"

for root, dirs, files in os.walk("output"):
    for file_ in files:
        if file_.endswith(".yaml"):
            # Assuming your present working directory is BlenderProc repo
            subprocess.call(["python", "run.py", file_, DATASET_PATH, OUTPUT_PATH], shell=False)

Did this help you? If so please close the issue if not, tell us.

Thank you @moizsajid

Was this page helpful?
0 / 5 - 0 ratings

Related issues

luigifaticoso picture luigifaticoso  路  6Comments

albertotono picture albertotono  路  3Comments

elientumba2019 picture elientumba2019  路  4Comments

ggaziv picture ggaziv  路  3Comments

matemato picture matemato  路  4Comments