A method implemented by one or more processors, the method comprising: identifying a size at which to render a foreground three-dimensional object model in a foreground layer for a synthetic image; for each of a plurality of randomly selected background 3D object models: rendering the background 3D object model, at a corresponding background location in a background layer for the synthetic image, with a corresponding rotation, and with a corresponding size that is determined based on the size at which the foreground 3D object model is to be rendered; rendering (308, 310) the foreground 3D object model at a foreground location in the foreground layer, the rendering of the foreground 3D object model being at the size and being at a given rotation of the foreground 3D object model; selecting an additional background 3D object model; identifying a random location within a determined bounding area that bounds the rendering of the foreground 3D object model; rendering the additional background 3D object model, in the identified random location within the determined bounding area and in an occlusion layer of the synthetic image, rendering the additional background 3D object model comprising scaling the additional background 3D object model before rendering so as to occlude only a portion of the rendering of the foreground 3D object model; generating the synthetic image based on fusing the background layer and the foreground layer, and the occlusion layer; assigning, to the synthetic image, a ground truth label for the rendering of the foreground 3D object model; and providing the synthetic image paired with the ground truth label as a training instance for training of at least one machine learning model for object detection and/or classification tasks based on the training instance. identifying a size at which to render a foreground three-dimensional object model in a foreground layer for a synthetic image; for each of a plurality of randomly selected background 3D object models: rendering the background 3D object model, at a corresponding background location in a background layer for the synthetic image, with a corresponding rotation, and with a corresponding size that is determined based on the size at which the foreground 3D object model is to be rendered; rendering (308, 310) the foreground 3D object model at a foreground location in the foreground layer, the rendering of the foreground 3D object model being at the size and being at a given rotation of the foreground 3D object model; selecting an additional background 3D object model; identifying a random location within a determined bounding area that bounds the rendering of the foreground 3D object model; rendering the additional background 3D object model, in the identified random location within the determined bounding area and in an occlusion layer of the synthetic image, rendering the additional background 3D object model comprising scaling the additional background 3D object model before rendering so as to occlude only a portion of the rendering of the foreground 3D object model; generating the synthetic image based on fusing the background layer and the foreground layer, and the occlusion layer; assigning, to the synthetic image, a ground truth label for the rendering of the foreground 3D object model; and providing the synthetic image paired with the ground truth label as a training instance for training of at least one machine learning model for object detection and/or classification tasks based on the training instance.