Maryeon, updated πŸ•₯ 2022-01-22 14:12:31

Fine-Grained Fashion Similarity Prediction by Attribute-Specific Embedding Learning (ASEN++)

This repository is a PyTorch implementation for the paper Fine-Grained Fashion Similarity Prediction by Attribute-Specific Embedding Learning. This work extends our previous work at AAAI 2020.

network structure

Table of Contents


  • Ubuntu 16.04
  • CUDA 10.1
  • Python 3.6

Install other required packages by

sh pip install -r requirements.txt


Data Split

To perform attribute-specific fashion retrieval, some index files ( are needed. It contains split annotations and meta data for three datasets, i.e., FashionAI, DARN, DeepFashion. Related files for each is included in a directory. Uncompress it by

sh unzip


After unzip the, a directory rooted as data is created and has a layout as following:

sh data β”œβ”€β”€ FashionAI β”‚Β Β  β”œβ”€β”€ candidate_test.txt β”‚Β Β  β”œβ”€β”€ candidate_valid.txt β”‚Β Β  β”œβ”€β”€ filenames_test.txt β”‚Β Β  β”œβ”€β”€ filenames_train.txt β”‚Β Β  β”œβ”€β”€ filenames_valid.txt β”‚Β Β  β”œβ”€β”€ label_train.txt β”‚Β Β  β”œβ”€β”€ query_test.txt β”‚Β Β  └── query_valid.txt β”œβ”€β”€ DARN β”‚Β Β  └── ... β”œβ”€β”€ DeepFashion β”‚Β Β  └── ... └── meta.json

Download Data


As the full FashionAI has not been publicly released, we utilize its early version for the FashionAI Global Challenge 2018. You can first sign up and download two training subsets:


Once done, you should uncompress and link them into the data/FashionAI directory.


As some images’ URLs have been broken, only 214,619 images are obtained for our experiments. We provide with a series of URLs for the images. Please download them into a pic directory that should be created in data/DARN directory.


DeepFashion is a large dataset which consists of four benchmarks for various tasks in the field of clothing including category and attribute prediction which we use for our experiments, in-shop clothes retrieval, fashion landmark detection and consumer-to-shop clothes retrieval. Download the images into a img directory that should be created in data/DeepFashion directory.


The behavior of our codes is controlled by configuration files under the config directory.

sh config │── FashionAI β”‚ β”œβ”€β”€ FashionAI.yaml β”‚ β”œβ”€β”€ s1.yaml β”‚ └── s2.yaml β”œβ”€β”€ DARN β”‚Β Β  β”œβ”€β”€ DARN.yaml β”‚Β Β  β”œβ”€β”€ s1.yaml β”‚Β Β  └── s2.yaml └── DeepFashion Β Β  β”œβ”€β”€ DeepFashion.yaml Β Β  β”œβ”€β”€ s1.yaml Β Β  └── s2.yaml

Each dataset is configured by two types of configuration files. One is <Dataset>.yaml that specifies basic dataset information such as path to the training data and annotation files. The other two set some training options as needed.

If the above data directory is placed at the same level with, no changes are needed to the configuration files. Otherwise, be sure to correctly configure relevant path to the data according to your working environment.


ASEN is trained in a two-stage way. For the first stage, we need to train the global branch. Run the following script that uses default settings:

python python --cfg config/<Dataset>/<Dataset>.yaml config/<Dataset>/s1.yaml

Based on the trained global branch, the second stages jointly train the whole ASEN:

python python --cfg config/<Dataset>/<Dataset>.yaml config/<Dataset>/s2.yaml --resume runs/<Dataset>_s1/checkpoint.pth.tar


Run the following script to test on the trained models:

python python --cfg config/<Dataset>/<Dataset>.yaml config/<Dataset>/s2.yaml --resume runs/<Dataset>_s2/model_best.pth.tar --test TEST

For your convenience, we also provide our trained model weights ( on the above three datasets. Just replace the resumed checkpoint file and run a test.


If it's of any help to your research, consider citing our work:

latex @artical{dong2021fine, title={Fine-Grained Fashion Similarity Prediction by Attribute-Specific Embedding Learning}, author={Dong, Jianfeng and Ma, Zhe and Mao, Xiaofeng and Yang, Xun and He, Yuan and Hong, Richang and Ji, Shouling}, journal={IEEE Transactions on Image Processing}, volume={30}, pages={8410--8425}, year = {2021} }

latex @inproceedings{ma2020fine, title={Fine-Grained Fashion Similarity Learning by Attribute-Specific Embedding Network}, author={Ma, Zhe and Dong, Jianfeng and Long, Zhongzi and Zhang, Yao and He, Yuan and Xue, Hui and Ji, Shouling}, booktitle={Thirty-fourth AAAI Conference on Artificial Intelligence}, year = {2020} }


DARN dataset - can't understand attribute values from configs

opened on 2021-05-11 12:20:00 by RemusMaz


I tested your code for DARN dataset and I can't understand attribute values from label_train.txt, candidates and query files. I can't find any details about this in your paper or code documentation. Can you provide more explanation about attribute values (numbers to words dictionary; ex: clothes category: 0: "T-shirt", 1: "skirt" ...) and what represents each column from label_train.txt file?

label_train.txt: 0 0 4 1 12 2 4 3 4 4 0 5 1 6 0 7 0 8 5 1 0 2 1 1 2 15 3 4 4 1 5 1 6 3 7 0 8 2 2 0 7 1 8 2 7 3 2 4 0 5 5 6 3 7 2 8 2 ... 171693 0 14 1 2 2 8 3 1 4 1 5 1 6 16 7 0 8 2 171694 0 15 1 3 2 12 3 1 4 0 5 1 6 0 7 2 8 0 171695 0 3 1 7 2 12 3 1 4 0 5 1 6 17 7 0 8 2