FGVR Tensorflow Baseline
This repo contains training code for FGVR classification using TensorFlow. This implementation achieves comparable state-of-the-art results.
Checkout the Wiki for more technical discussion.
FVGR is a classification task where intra category visual differences are small and can be overwhelmed by factors such as pose, viewpoint, or location of the object in the image. For instance, the following image shows a California gull (left) and a Ringed-beak gull (Right). The beak pattern difference is the key for a correct classification. Such a difference is tiny when compared to the intra-category variations like pose and illumination. FVGR dataset typically involve animal species, models of cars or aircrafts. The following table list six well-known FGVR datasets.
|Dataset||Num Classes||Avg samples Per Class||Train Size||Val Size||Test Size|
- Python 3+ [Tested on 3.4.7]
- Tensorflow 1+ [Tested on 1.8]
I prepare my datasets in an un-conviention way.
dataset_sample folder provides an example for the cars dataset. Instead of caffe style, listing files and labels in txt file, I use csv file. Reading dataset content in Excel is more appealing, to me, than txt file. To use caffe txt dataset style, make sure to modify
BaseTupleLoader. This should be trivial since these classes return a list of filenames and labels
Augmentation using random cropping and horizontal flipping on. No color distortion, vertical flipping or any complex augmentation is employed. The results are preliminary because I didn't wait for till max_iters -- patience is a virtue I am still learning. Other datasets results and other models like resnet50 will be added later.
Make sure to edit the (1) dataset_dir (2) pretrained_weights_dir in configuration.py.
The following deserve credit for the tips and help provided to finish this code and achieve the reported results
- Accumulated Gradient in Tensorflow.
- Training and Evaluating at both time.
- Batch Level Augmentation.
- Write a Wiki about Accumulated Gradient in Tensorflow
- Write a Wiki about Batch normalization and how to train and evaluate concurrently.
- Report results of these fgvr datasets
- Add ResNet implementation
- Add other dataset loaders
I am not a Python expert; so both tips to improve the code and pull requests to contribute are very welcomed