Collection

class deepbench.collection.Collection(object_config=None)

Take a configuration file (dictionary) and produce the simulation output, automatically passing arguments where they need to be.

Handles both compositional images (ones with multiple objects) and single object images

Holds onto all the parameters used to make these files, including the default parameters, for replication.

Parameters:
  • object_config (dict, optional) – dictionary containing the parameters for the simulation output. Required fields: * object_type: [sky, shape, physics, astro] : overall type of image * object_name: Name of the class used in the image generation (e.g. - Pendulum, Star) * total_runs: Number of times the simulation will be executed * image_parameters: parameters for the image itself. In single object images, this is the parameters for the parent class. * object parameters: list of objects that will be included in each image and their parameters

  • None. (Defaults to)

add_object()

Use the parameters set by the configuration file to create an object and store that and its associated parameters Adds noise to parameters if set by the program perviously

If the specified object is a composite image, it will only find the default values for the compositor method, not the indivual simulations

add_parameter_noise(seed, params)

Add noise to the image wide parameters

Parameters:
  • seed (int) – integer stored by the program to denote the noise seed added to the object

  • params (dict) – parameters that have added noise.

Returns:

parameters with added uniform noise

Return type:

dict

engine_defaults()

Locate the default parameters for any simulation being called, via the inspect.signature method

Returns:

all the parameters either default to the called object or modified by the program

Return type:

dict

from_config(config_path)

Read an external configuration file and initalize the dataset. Must be run if a configuration is not supplied at initalization.

Parameters:

config_path (str) – Path to yaml file containing an object dictionary. Object dictionary must have the parameters: “object_type”,”object_name”,total_runs”,image_parameters”,”object_parameters”

save(save_path=None, format='h5')

Save generated dataset to path of your choosing. If the path is not specified, the program will look for a save path to be specified by the configation_file

Parameters:
  • save_path (str, optional) – directory, location to save a file. Will be created if does not already exist. Defaults to None.

  • format (str, optional) – Format to save the file in. Defaults to h5.