MCPcopy Create free account
hub / github.com/VITA-Group/Diffusion4D / execute_command

Function execute_command

rendering/render.py:36–70  ·  view source on GitHub ↗
(args,glb_file, gpu_id,file_name)

Source from the content-addressed store, hash-verified

34
35
36def execute_command(args,glb_file, gpu_id,file_name):
37 #print('args.azimuth_aug:',args.azimuth_aug)
38 if args.azimuth_aug:
39 azimuth=round(random.uniform(0, 1), 2)
40 file_name+=f'_az{azimuth:.2f}'
41 else:
42 azimuth=0
43
44 if args.elevation_aug:
45 elevation= random.randint(5,30)
46 file_name+=f'_el{elevation:.2f}'
47 else:
48 elevation=0
49
50
51 save_path=os.path.join(args.save_dir,file_name)
52 command=f'CUDA_VISIBLE_DEVICES={gpu_id} export DISPLAY=:0.1 && blender-3.2.2-linux-x64/blender \
53 --background --python blender.py -- \
54 --object_path {glb_file} \
55 --frame_num {args.frame_num} \
56 --output_dir {save_path} \
57 --gpu_id {gpu_id} \
58 --azimuth {azimuth}\
59 --elevation {elevation}\
60 --resolution {args.resolution} \
61 --mode_multi {args.mode_multi}\
62 --mode_static {args.mode_static}\
63 --mode_front {args.mode_front_view}\
64 --mode_four_view {args.mode_four_view}'
65
66 print('command:',command)
67 logging.info(f'Executing command: {command}')
68 result = subprocess.run(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
69 logging.info(result.stdout.decode())
70 logging.error(result.stderr.decode())
71
72
73

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected