GithubHelp home page GithubHelp logo

gregiberri / traffic_sign_recognition Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 373 KB

Traffic sign classification with small highly imbalanced data.

Python 43.25% Jupyter Notebook 56.75%
deep-learning classification pytorch

traffic_sign_recognition's Introduction

Traffic light recognition

Requirements

The required packages can be found in config/env_files/traffic_sign_recognition_env.yml. Dependencies could be installed by running:

conda env create -f config/env_files/traffic_sign_recognition_env.yml

Configuration

The experiments are run according to configurations. The config files for those can be found in config/config_files. Configurations can be based on each other. This way the code will use the parameters of the specified base config and only the newly specified parameters will be overwritten.

The base config file is base.yaml. A hpo example can be found in base_hpo.yaml which is based on base.yaml and does hyperparameter optimization only on the specified parameters. An example for test based on base.yaml can be found in test.yaml.

Arguments

The code should be run with arguments:

--id_tag specifies the name under the config where the results will be saved
--config specifies the config name to use (eg. config "base" for config/config_files/base.yaml)
--mode can be 'train', 'val', 'test' or 'hpo'

Required data

The required data's path should be specified inside the config file like:

data:
  params:
  dataset_path: '/home/data/R-jpg' \

During train, val and hpo the files should be under their class subdirectory (eg. /home/data/R-jpg/stop_table).
During test the files should all be in the specified directory.

Saving and loading experiment

The save folder for the experiment outputs can be set in the config file like:

id: "base"
env:
  result_dir: 'results'

All the experiment will be saved under the given results dir: {result_dir}/{config_id}/{id_tag arg}

  1. tensorboard files
  2. train and val metric csv
  3. the best model
  4. confusion matrices and by class metrics

If the result dir already exists and contains a model file then the experiment will automatically resume (either resume the training or use the trained model for inference.)

Usage

Training

To train the model use:

python run.py --config base --mode train

Eval

For eval the results dir ({result_dir}/{config_id}/{id_tag arg}) should contain a model as model_best.pth.tar. During eval the validation files will be inferenced and the metrics will be calculated.

python run.py --config base --mode val

Test

For test the results dir ({result_dir}/{config_id}/{id_tag arg}) should contain a model as model_best.pth.tar. During test the predictions will be saved along with the filepaths in a csv file.
A pretrained model can be found in here. For simplicity it is recommended to copy it under results/base/base and just change the dataset path to yours in config/config_files/test.yaml.

python run.py --config test --mode test

HPO

For hpo use:

python run.py --config base_hpo --mode hpo

Example of the results:

HPO result: Screenshot from 2021-11-16 01-07-55

Confusion matrix: confusion_matrix_val_40

By class F1 score: F1_val_40

traffic_sign_recognition's People

Contributors

gregiberri avatar

Stargazers

 avatar

Watchers

 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.