/BlenderProc-service

Synthetic Data Generation Service using BlenderProc in Docker

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

A dockerised service for Bounding Box and Segementation data generation using Blenderproc

License: GPL v3

Labelled generated data

Requirements:

  • Linux 20.04
  • Python 3.5.2+
  • Docker
  • Kubernetes

Setup

Prepare objects/scenes

Objects/scenes are available across the web. A couple of good free sites:

Prepare output folder structure

The microservice by default outputs data to /data/nfs1/synth, using /data/nfs1/synth/temp during creation. Before commencing, create this directory structure and set permissions to -rwxrwsrwx using:

chmod -R 2777 /data/nfs1

The Data Generation process

This microservice creates a kubernetes pod/docker container which fulfils requests. The process:

  • Uses Swagger CodeGen to generate server code
  • Builds the BlenderProc docker
  • Builds and deploys the data generation microservice
  • Sends a data generation request after a small wait to test the service end to end
  • Further requests can be sent by modifying the request.json and running:
make curl_docker

Annotations are produced in the standard COCO json format.

Run the Data Generation microservice in docker

make all_docker

Run the Data Generation microservice in kubernetes

make all_kube # if sudo is required
make all_nosudo # if not

NB:

The kubernetes version expects a NFS to be configured, with its ip address specified in synth-pv-pvc.yaml: (spec:nfs:server)

Modifying the scene

The request.json specifies details of how the scene is produced. The flow of the program is as follows:

  • A point of interest is specified in the scene where the model is placed
  • The program stochasticly shifts the point of interest (within a range) so the object isn't in the direct centre of the screen (camera_shift_range_xyz)
  • The program specifies a random camera location within a range (camera_location_range_xyz)
  • The rotation matrix calculates the camera angle change required to point the camera towards the point of interest