AI City 2021: Connecting Language and Vision for Natural Language-Based Vehicle Retrieval

? The 1st Place Submission to AICity Challenge 2021 Natural Language-Based Vehicle Retrieval Track (Alibaba-UTS submission)


We have two codebases. For the final submission, we conduct the feature ensemble, where features are from two codebases.

Part One is at here:

Part Two is at here:


  • Preprocess the dataset to prepare frames, motion maps, NLP augmentation

scripts/ is a Python script that is used to extract frames.

scripts/ is a Python script that is used to get motion maps.

scripts/ is a Python script that is used for NLP augmentation.

  • Download the pretrained models of Part One to checkpoints. The checkpoints can be found here. The best score of a single model on TestA is 0.1927 from motion_effb3_NOCLS_nlpaug_320.pth.

The directory structures in data and checkpoints are as follows:

├── checkpoints
│   ├── motion_effb2_1CLS_nlpaug_288.pth
│   ├── motion_effb3_NOCLS_nlpaug_320.pth
│   ├── motion_SE_3CLS_nonlpaug_288.pth
│   ├── motion_SE_NOCLS_nlpaug_288.pth
│   └── motion_SE_NOCLS_nonlpaug_288.pth
└── data
    ├── AIC21_Track5_NL_Retrieval
    │   ├── train
    │   └── validation
    ├── motion_map 
    ├── test-queries.json
    ├── test-queries_nlpaug.json    ## NLP augmentation (Refer to scripts/
    ├── test-tracks.json
    ├── train.json
    ├── train_nlpaug.json
    ├── train-tracks.json
    ├── train-tracks_nlpaug.json    ## NLP augmentation (Refer to scripts/
    ├── val.json
    └── val_nlpaug.json             ## NLP augmentation (Refer to scripts/

Part One

  • Modify the data paths in


The configuration files are in configs.

CUDA_VISIBLE_DEVICES=0,1,2,3 python -u --name your_experiment_name --config your_config_file |tee log


Change the RESTORE_FROM in your configuration file.

python -u --config your_config_file

Extract the visual and text embeddings. The extracted embeddings can be found here.

python -u --config configs/motion_effb2_1CLS_nlpaug_288.yaml
python -u --config configs/motion_SE_NOCLS_nlpaug_288.yaml
python -u --config configs/motion_effb2_1CLS_nlpaug_288.yaml
python -u --config configs/motion_SE_3CLS_nonlpaug_288.yaml
python -u --config configs/motion_SE_NOCLS_nonlpaug_288.yaml

Part Two



During the inference, we average all the frame features of the target in each track as track features, the embeddings of text descriptions are also averaged as the query features. The cosine distance is used for ranking as the final result.

  • Reproduce the best submission. ALL extracted embeddings are in the folder output:

python scripts/

Friend Links:


View Github