MCPcopy Create free account
hub / github.com/deepdrive/deepdrive / randomize_cameras

Function randomize_cameras

tensorflow_agent/agent.py:341–358  ·  view source on GitHub ↗
(cameras)

Source from the content-addressed store, hash-verified

339
340
341def randomize_cameras(cameras):
342 for cam in cameras:
343 # Add some randomness to the position (less than meter), rotation (less than degree), fov (less than degree),
344 # capture height (1%), and capture width (1%)
345 for i in range(len(cam['relative_rotation'])):
346 cam['relative_rotation'][i] += math.radians(np.random.random())
347 for i in range(len(cam['relative_position'])):
348 if i == 0 or i == 2:
349 # x - forward or z - up
350 cam['relative_position'][i] += (np.random.random() * 100)
351 elif i == 1:
352 # y - right
353 cam['relative_position'][i] += (np.random.random() * 100 - 50)
354
355 cam['field_of_view'] += (np.random.random() - 0.5)
356 cam['capture_height'] += round(np.random.random() * 0.01 * cam['capture_height'])
357 cam['capture_width'] += round(np.random.random() * 0.01 * cam['capture_width'])
358 pass
359
360def random_use_sim_start_command(should_rotate_sim_types):
361 use_sim_start_command = should_rotate_sim_types and np.random.random() < 0.5

Callers 1

runFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected