Skip to content

Training and evaluation

grasppanda train trains a method from its config. grasppanda test evaluates a checkpoint on the test split of the dataset of the config. The example trains EconomicGrasp on GraspNet-1Billion with the RealSense camera.

Requirements

Requirement Detail
Dataset GraspNet-1Billion in the folder layout of its download (Datasets)
Label assets Built by grasppanda prepare from the grasp labels of the dataset
Extra spconv-* for GSNet, EconomicGrasp and FineGrasp (Installation)
Device runtime.device: auto selects a CUDA GPU if one is visible, otherwise the CPU

Dataset and label assets

export GRASPPANDA_GRASPNET1B_ROOT=/path/to/graspnet1b
export GRASPPANDA_CACHE=/path/to/cache
CONFIG=economicgrasp/economicgrasp_sunet14_g1b-realsense_10e
grasppanda prepare graspnet1b --labels
grasppanda prepare graspnet1b --graspness --camera realsense
grasppanda prepare graspnet1b --compact-labels --config $CONFIG
grasppanda prepare graspnet1b --check --config $CONFIG
Variable Content Default
GRASPPANDA_GRASPNET1B_ROOT Folder of the GraspNet-1Billion download $GRASPPANDA_DATA/graspnet1b, then ./data/graspnet1b
GRASPPANDA_CACHE Folder for generated label assets ~/.cache/grasppanda

prepare reads the dataset folder and writes the label assets to the cache folder. --check lists the missing files of the dataset and the missing assets of the config. --labels builds the grasp-label store, which the other assets are generated from.

Method Options of prepare after --labels
GraspNet-baseline --tolerance
GSNet --graspness
Scale-Balanced-Grasp --tolerance, --scale-statistic
EconomicGrasp --graspness, --compact-labels
FineGrasp --graspness, --compact-labels
HGGD --view-grasps

Datasets gives the prepare commands of each method.

Training

grasppanda train $CONFIG --opts runtime.run_id=run1

The run directory is work_dirs/<config name>/<run id>/. Without runtime.run_id, the run id is the start time.

After each epoch, train evaluates on ten scenes of the training split (val_dev, every 16th frame) and writes checkpoints/epoch_NNNN.pth. The three latest checkpoints are kept.

A run that stops before its first checkpoint keeps its directory. Delete work_dirs/<config name>/<run id> or set another runtime.run_id before the next attempt.

Option Effect
--opts KEY=VALUE ... Overrides config values, for example train.epochs=20
--work-dir DIR Sets runtime.work_dir
--resume [CHECKPOINT] Continues from the latest checkpoint of the run directory or from a file
File of the run directory Content
config.resolved.yaml Config with all defaults
log.txt Log of the run
checkpoints/ epoch_NNNN.pth, and best.pth with evaluation.save_best
predictions/<variant>/ Predicted grasps of each frame as (G, 17) arrays
results/ Result records as JSON

torchrun --nproc_per_node=4 -m grasppanda.cli.main train $CONFIG trains with one process per GPU. grasppanda sweep <file> --gpus 0,1,2,3 runs the configs of a sweep file in parallel, one per GPU. Training and evaluation describes both.

Evaluation

grasppanda test $CONFIG \
    --weights work_dirs/economicgrasp_sunet14_g1b-realsense_10e/run1/checkpoints/epoch_0010.pth

test evaluates on test seen, test similar and test novel, once per post-processing variant of the config. The shipped configs define the variants raw and cd, without and with the collision filter. test writes one result record per variant to work_dirs/<config name>/<start time>-test/results/<variant>.json.

Released weights are evaluated with the same command after conversion (Inference with released weights).

Result analysis

grasppanda analyze <run directory>

analyze reads the result records of a run and reports precision per friction threshold, split, scene and object. It requires no dataset and no weights (Result analysis).

Evaluation on GraspClutter6D

The configs named *-to-gc6d-* evaluate a model trained on GraspNet-1Billion on GraspClutter6D. GRASPPANDA_GRASPCLUTTER6D_ROOT is the folder of the GraspClutter6D download (Cross-dataset evaluation).