3D environment
3D model
Background image
Lighting and camera parameters
By default, computer vision models learn to extrapolate between domains
Domain randomization makes the model interpolate to the target domain
import random
from sklearn.datasets import make_blobs
light_intensity = random.uniform(0.1, 2)
X, _ = make_blobs(n_samples=100, centers=10, n_features=2)
Domain adaptation reduces the dissimilarity between domains
net_G = CutGenerator()
net_S = HarDMSEG()
adapted_image = net_G(synthetic_image)
prediction = net_S(adapted_image)
loss_G = criterion_G(adapted_image, synthetic_image)
loss_D = criterion_D(adapted_image, synthetic_image)
loss_S = criterion_S(prediction, synthetic_label)
loss_GAN = 0.1 * (loss_G + loss_D) + 0.9 * loss_S
loss_GAN.backward()