Docker for VirtualvirtualplantimagerLink
PrerequisitesLink
Follow the getting started with docker instructions to install the required software.
Important
We advise to assign an existing local database directory to $ROMI_DB
, it will be mounted at container startup.
To see how to create a local database directory, look here.
Start a containerLink
Assuming you have a valid ROMI database directory under /data/ROMI/DB
, you can easily download and start the
pre-built roboticsmicrofarms/virtualplantimager
docker image with one of the following command:
From the root directory of the repository, use the convenience run.sh
script:
export ROMI_DB=/data/ROMI/DB
./docker/run.sh
From the root directory of the repository, use the convenience run.sh
script:
./docker/run.sh -db /data/ROMI/DB
From any directory, assuming you created a romi
group, use the docker run
command as follows:
export ROMI_DB=/data/ROMI/DB
# Get the GID associtated to the 'romi' group:
gid=$(getent group romi | cut --delimiter ':' --fields 3) # get the 'gid' of this group
# Start the container:
docker run --runtime=nvidia --gpus all \
--env PYOPENCL_CTX='0' \
--user romi:${gid} \
-v $ROMI_DB:/myapp/db \
-it roboticsmicrofarms/virtualplantimager:latest
This should start the latest pre-built roboticsmicrofarms/virtualplantimager
docker image in interactive mode.
The database location inside the docker container is /myapp/db
.
Note
-v $ROMI_DB:/myapp/db
performs a bind mount to enable access to the local database by the docker image. See the official documentation.- Use
./docker/run.sh -h
to get all details about how to use it.
Build a docker imageLink
If you do not wish to use one of the roboticsmicrofarms/virtualplantimager
pre-built image, you may build an image using
the docker/virtualplantimager/Dockerfile
recipe.
We provide a convenience bash script to ease the build of roboticsmicrofarms/virtualplantimager
docker image.
You can choose to use this script OR to "manually" call the docker build
command.
From the root directory of the repository, use the convenience build.sh
script:
./docker/build.sh
From the root directory of the repository, use the docker build
command as follows:
export VTAG="latest"
docker build -t roboticsmicrofarms/virtualplantimager:$VTAG .
Tips
- By default, the image tag is 'latest', you can change it, e.g. to 'dev' with
-t dev
. - Use
./docker/build.sh -h
to get all details about how to use it.
You may want to clean the build cache, at least from time to time, with:
docker builder prune -a
Publish docker imageLink
To push a newly built image on docker hub:
export VTAG="latest"
docker push roboticsmicrofarms/virtualplantimager:$VTAG
This requires a valid account & token on dockerhub!
Example usageLink
TestLink
You can test the creation of a virtual plant and its acquisition by the virtual scanner as follows:
./docker/virtualplantimager/run.sh --test
Executing a ROMI taskLink
To call a ROMI task, as defined in the romitask
library, you should use the romi_run_task
CLI.
For example to create a virtual plant and acquire it with the VirtualScanner
, as <my_vscan>
, using the Blender server , you may use the following command:
romi_run_task VirtualScan \
/myapp/db/<my_scan>/ \
--config plant-imager/configs/vscan_lpy_blender.toml
Important
The previous command rely on the presence of a vscan_data
directory, as it contains the LPY model, background and textures to use (as defined by the TOML configuration file).
It is accessible in the repository under plant-imager/database_example/vscan_data
.
TOML configLink
Todo
The following subsections need to be reviewed!
VirtualPlantLink
To generate a virtual plant using LPY, the default configuration is as follows:
[VirtualPlant]
lpy_file_id = "arabidopsis_notex"
[VirtualPlant.lpy_globals]
BRANCHON = false
MEAN_NB_DAYS = 40
STDEV_NB_DAYS = 5
BETA = 51
INTERNODE_LENGTH = 1.3
STEM_DIAMETER = 0.25
VirtualScanLink
To perform a scan of a virtual plant, the default configuration is as follows:
[PaletteFileset]
scan_id = "vscan_data"
[HdriFileset]
scan_id = "vscan_data"
[LpyFileset]
scan_id = "vscan_data"
[ScanPath.kwargs]
center_x = 0
center_y = 0
z = 32
tilt = 3
radius = 40
n_points = 36
[ScanPath]
class_name = "Circle"
[VirtualScan]
load_scene = false
scene_file_id = ""
use_palette = true
use_hdri = true
obj_fileset = "VirtualPlant"
hdri_fileset = "HdriFileset"
scene_fileset = "SceneFileset"
palette_fileset = "PaletteFileset"
render_ground_truth = true
colorize = true
[VirtualScan.scanner]
width = 1440
height = 1080
focal = 16
flash = false
port = 9001
add_leaf_displacement = true