Coder Social home page Coder Social logo

5m0k3 / gwd-efficientdet-pytorch Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 0.0 11.36 MB

My modified version of EfficientDet training, cross-validation and inference with Pseudo Labelling pytorch pipelines used in GWD Kaggle Competition

Jupyter Notebook 100.00%
object-detection pseudo-labelling kaggle pytorch-implementation efficientdet test-time-augmentation agriculture-research

gwd-efficientdet-pytorch's Introduction

pytorch based EfficientDet solution - Global Wheat Detection

A complete pytorch pipeline for training, cross-validation and inference notebooks used in Kaggle competition Global Wheat Detection (May-Aug 2020)

Table of Contents

Brief overview of the competition images

Wheat heads were from various sources:
head
A few labeled images are as shown: (Blue bounding boxes)
head head

Notebooks description

A brief content description is provided here, for detailed descriptions check the notebook comments

[TRAIN] notebook

  1. Pre-Processing:
    - Handled the noisy labels (too big/small boxes etc.)
    - Stratified 5 fold split based on source

  2. Augmentations:
    - Albumentations - RandomSizedCrop, HueSaturationValue, RandomBrightnessContrast, RandomRotate90, Flip, Cutout, ShiftScaleRotate
    - Mixup - https://arxiv.org/pdf/1710.09412.pdf
    2 images are mixed
    head
    - Mosaic - https://arxiv.org/pdf/2004.12432.pdf
    4 images are cropped and stitched together
    head
    - Mixup-Mosaic: Combining the above two, applying mixup to 2 (top-right and bottom-left) of the 4 quarters of mosaic
    head

  3. Configurations:
    - Optimizer - Adam Weight Decay (AdamW)
    - LR Scheduler - ReduceLRonPleateau (initial LR = 0.0003, factor = 0.5)
    - Model - EfficientDet D5 (pytorch implementation of the original tensorflow version)
    - Input Size - 1024 * 1024
    - Last and Best 3 checkpoints saved

[CV] Cross Validation notebook

  1. Pre-Processing:
    - Same as in [TRAIN]

  2. Test Time Augmentations:
    - Flips and Rotate
    head
    - Color shift
    - Scale (scale down with padding)

  3. Ensemble:
    - Support for ensembling of multiple folds of the same model
    - Weighted Boxes Fusion is used to ensemble final predicted boxes

  4. Automated Threshold Calculations:
    - Confidence level threshold is calculated based on ground truth labels
    - Optimal Final CV score (Metric: IoU) is obtained through this

[INFERENCE] Submission notebook

  1. Test Time Augmentations:
    - Same as in [CV]

  2. Pseudo Labelling:
    - Multi-Round Pseudo Labelling pipeline based on https://arxiv.org/pdf/1908.02983.pdf
    - Implemented Cross Validation calculations at the end of each round to decide the best thresholds for Pseudo Labels in the next round
    - Training pipeline same as in [TRAIN]
    head

  3. Post-Processing and Result:
    - Included final bounding boxes reshaping function
    (Red : Original | Blue : Altered {+5%})
    head
    - Final predictions made with ensembled combinations of TTA

How to use

Just change the directories according to your environment.

Google Colab deployed versions are available for
[TRAIN] Open In Colab
[CV] Open In Colab

In case of any deprecation issues/warnings in future, use the modules available in Resources folder.

Improvements

Acknowledging the shortcomings is the first step for progress. Thus, listing the possible improvements that could've made my Model better:

  • Ensemble Multi-Model/Fold predictions for Pseudo Labels, currently single model is used to make pseudo labels. Would've made the model more robust to noise too.
  • GAN or Style Transfer could've been used to produce more similar labeled images from the current train images for better generalization.
  • Relabeling of noisy labels using multi-folds. (Tried but failed)
  • IoU loss used in training should be replaced by modern SOTA GIoU, CIoU or DIoU

gwd-efficientdet-pytorch's People

Contributors

5m0k3 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

gwd-efficientdet-pytorch's Issues

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.