Coder Social home page Coder Social logo

kaggle-cat-and-dog's Introduction

Kaggle Cat and Dog Competition

Introduction

Kaggle Dog v.s. Cat competition

Model & Performance

  1. Model: ResNet50
  2. Train & Validation ratio: 0.85: 0.15
  3. Performance
    • accuracy: 99.25%
    • recall: 99.04%
    • precision: 99.46%
    • auc: 99.97%

Resource

  1. Environment: Linux
  2. Python version: 3.10.12
  3. GPU: V100, 16G

Installation

  1. Create virtualenv
    python -m venv cat_dog_env
    source cat_dog_env/bin/activate
    
  2. Install dependencies
    pip install -r requirements.txt
    

Command Line Interface

  1. Train: Train image classifier.

    python tools/train.py --config_file ${config_file} \
                          --exp_name ${exp_name} \
                          --img_dir ${img_dir} 
                          --test_ratio ${test_ratio}  \
                          --bs ${batch_size} \
                          --lr ${lr} \
                          --weight_decay ${weight_decay} \ 
                          --weight ${weight}
                          [--adam] \ 
                          [--adamw]
    
    • config_file: Training configuration file. File contains model confiiguration, training strategy, etc. Configuration files are in configs/ folder.
    • exp_name: The name of current experiemnt. Training aritfacts (model weights, ROC graph, confusion matrix graph, performance report, etc) will be save in checkpoints/{exp_name} folder.
    • img_dir: Folder containing all training images.
    • test_ratio: Validation set ratio.
    • bs: Training batch size.
    • lr: Learning rate.
    • adam: Use Adam optimizer during training.
    • adamw: Use AdamW optimizer during training.
    • weight_decay: Weight_decay regularization.
    • weights: Pretained model weight path.
  2. Inference: Predict image categories in the folder.

    python tools/inference.py --config_file ${config_file} \
                              --img_dir ${img_dir} \
                              --bs ${batch_size} \ 
                              --weight ${weight} \
                              --save_path ${save_path}
    
    • config_file: Configuration file for inference.
    • img_dir: Folder containing all images to be predicted.
    • bs: Inference batch size.
    • weight: Pretained model weight path.
    • save_path: Prediction result will save to this file.
  3. Evaluate: Evaluate the model performance.

    python tools/evaluate.py --config_file ${config_file} \
                              --csv_path ${csv_path} \ 
                              --img_dir ${img_dir} \
                              --bs ${batch_size} \ 
                              --weight ${weight} \
                              --save_path ${save_path}
    
    • config_file: Configuration file for evaluation.
    • csv_path: csv file containing testing image names and labels. csv_file should contain name(image name) & label(image category) columns. Example
    • img_dir: Folder containing all images to be predicted.
    • bs: Inference batch size.
    • weight: Pretained model weight path.
    • save_dir: Path to save evaluation artifacts, including ROC graph, confusion matrix graph.

Experiments

  1. Resnet50: link
  2. Convnext
  3. Swin Transformer
  4. BEITv2

kaggle-cat-and-dog's People

Contributors

travisergodic avatar

Stargazers

victor chen 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.