Giter Site home page Giter Site logo

world6677 / stanford-cars-model Goto Github PK

View Code? Open in Web Editor NEW

This project forked from phongdinhv/stanford-cars-model

0.0 0.0 0.0 468 KB

A PyTorch model for Stanford Cars Datasets: https://ai.stanford.edu/~jkrause/cars/car_dataset.html

License: MIT License

Python 94.47% Jupyter Notebook 5.53%

stanford-cars-model's Introduction

stanford-cars-model (under development)

A PyTorch model for Stanford Cars Classification

Dependencies

  • python 3.7
  • pytorch
  • scikit-image
  • numpy
  • opencv-python
  • tensorboard

Install

Extract training & testing data using annotation bounding box

Data Prepare

data_processing/
│
├── datasets/ - folder contain training & testing data
    ├── cars_metas/ - folder contain meta data for training & testing
        ├── cars_train_annos.mat - train meta
        ├── cars_test_annos_withlabels.mat - test meta
    ├── training/
        ├── original/ - original cars from training data
          ├── 00001.jpg
          ├── 00002.jpg
          ├── 00003.jpg
          ├── 00004.jpg
          ├── ...
        ├── extracted/ - cars after extracted using bounding box label
    ├── testing/
        ├── original/ - original cars from testing data
          ├── 00001.jpg
          ├── 00002.jpg
          ├── 00003.jpg
          ├── 00004.jpg
          ├── ...
        ├── extracted/ - cars after extracted using bounding box label
        

Training data download: http://imagenet.stanford.edu/internal/car196/cars_train.tgz

Testing data download: http://imagenet.stanford.edu/internal/car196/cars_test.tgz

After download, extract and copy image to data_processing/datasets/training/original and data_processing/datasets/testing/original

Data Extract

Standford Cars Dataset come with annotated label, so we would like to use it to extract only cars and remove background. This help our model focus only on vehicles

For training:

cd data_processing
python extract_cars.py --meta "datasets/cars_metas/cars_train_annos.mat" -input "datasets/training/original/ -output "datasets/training/extracted/"

For testing:

cd data_processing
python extract_cars.py --meta "datasets/cars_metas/cars_test_annos_withlabels.mat" -input "datasets/testing/original/ -output "datasets/testing/extracted/"

Training

The model contain:

  • ResNet 151
  • Cyclic Learning Rate: default from 0.01 to 0.1
  • Auto Augmentation with ImageNet pretrained

You can start training model imediately with the following script:

python train.py -c train_config.json

Resuming

python train.py -c train_config.json -r "path/to/model.pth"

Visualization

alt text

Testing

You can download pretrained model here: https://www.dropbox.com/s/w550z44ur2pwr4j/model_best.pth?dl=0

And run following script with downloaded model to predict classes on test set

python test.py -c test_config.json -m "pretrained_model.pth" -o "test_output/"

Final result

Test Accuracy: 93.4%

stanford-cars-model's People

Contributors

phongdinhv avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.