Submission for the DSTA TIL 2020 AI Competition.
Object detection of Fashion Images using the Detectron2 framework.
The following additional datasets were utilized in the training of our models:
To install Detectron2 and its dependencies, refer to the official installation instructions.
Each training run is completely defined by customizable parameters in its configuration file, with a few templates already specified in the configs folder.
For example, all the existing config files train the models with pretrained COCO weights:
cascade_mask_rcnn.yaml
: Cascade Mask R-CNN model with ResNet50 backbone.faster_rcnn.yaml
: Faster R-CNN model with ResNet50 backbone.retinanet.yaml
: RetinaNet model with ResNet50 backbone.
Other types of models and their respective configs and pretrained weights can be found in the official Detectron2 Model Zoo.
While you can refer to the config reference for a full list of available parameters and what they mean, I've annotated some of them in the existing configs, and some notable ones to customize are:
SOLVER.IMS_PER_BATCH
: Batch sizeSOLVER.BASE_LR
: Base learning rateSOLVER.STEPS
: The iteration number to decrease learning rate by GAMMASOLVER.MAX_ITER
: Total number of training iterationsSOLVER.CHECKPOINT_PERIOD
: Saves checkpoint every number of stepsINPUT.MIN_SIZE_TRAIN
: Image input sizesTEST.EVAL_PERIOD
: The period (in terms of steps) to evaluate the model during trainingOUTPUT_DIR
: Specify output directory to save checkpoints, logs, results etc.
To train on a single gpu:
python train_net.py \
--config-file configs/cascade_mask_rcnn.yaml \
OUTPUT_DIR output/cascade # Specify output directory to save weights, logs etc.
To train on multiple gpus:
python train_net.py \
--num-gpus 4 \
--config-file configs/cascade_mask_rcnn.yaml \
OUTPUT_DIR output/cascade # Specify output directory to save weights, logs etc.
To resume training from a checkpoint (finds last checkpoint from cfg.OUTPUT_DIR)
python train_net.py \
--config-file config.yaml \ # Config file of halted run
--resume
To see all other options:
python train_net.py -h
This command only runs evaluation on the test dataset:
python train_net.py \
--eval-only \
--config-file configs/cascade_mask_rcnn.yaml \ # Config file of trained model
MODEL.WEIGHTS /path/to/checkpoint_file \ # Path to trained checkpoint
OUTPUT_DIR output/eval # Specify output directory to save results, predictions etc.