Coder Social home page Coder Social logo

zhangjy2008327 / sdaia_hack_theme1 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sahajgg/sdaia_hack_theme1

0.0 0.0 0.0 18.62 MB

Diffusion for Object Detection

License: MIT License

Shell 0.04% C++ 0.28% Python 4.22% CMake 0.02% Jupyter Notebook 95.44%

sdaia_hack_theme1's Introduction

Diffusion for Object Detection

Smartathon: The Smart Cities Challenge : Theme 1 Denoise predictions from Object Detection models using diffusion-based sequential denoising.

Project Link: https://github.com/sahagar/SDAIA_Hack_Theme1

Project Overview

Large-Scale real-world datasets often contain significantly more noise than academic benchmark datasets. Diffusion can be used as a denoising algorithm to further align and generalize model performance.

  • Use Yolov6 as the base object detection framework and train it on processed Theme 1 dataset.
  • Predictions from Yolov6 are used as the initial proposals for the diffusion model which uses a Resnet-50 backbone for feature extraction.
  • Train the diffusion model to generate corrected proposals by denoising the initial proposals over several time-stamps.

Generating Submission File

  • Build and run docker using provided DockerFile
    • docker build -f DockerFile -t sdaiahack:latest .

    • docker run --rm --gpus all -v <path-to-dataset-directory>:/data -v <path-to-model-directory>:/output --name sdaiahack-container -it sdaiahack:latest

    • Assumes <path-to-dataset-directory> contains unzipped Theme1_dataset and is mounted read/write

      ├── <path-to-dataset-directory>/
      │   ├── Theme1_dataset/
      │   │   │   ├── images/
      │   │   │   ├── 0a1ea4614a9df912eeb8d1b40bffee74`.jpg
      │   │   │   ├── 0a2bc0dc2371794509f4b776aff0dd88.jpg
      │   │   │   ├── ...
      │   │   │   └── 0a82e45ed11fb9ef1620a0b40cd9f6d8.jpg
      │   │   ├── sample_submission.csv
      │   │   ├── test.csv
      │   │   └── train.csv
    • Assumes <path-to-model-directory> is mounted read/write

  • Download trained model from checkpoint to <path-to-model-directory>/yolov6_train_output/exp/weights/best_ckpt.pt
    • mkdir -p <path-to-model-directory>/yolov6_train_output/exp/weights
    • md5 checksum: 8f379b2e998ffc80c51e625496135cb0
  • Run evaluate_yolov6.sh from /workspace inside docker. submission.csv will be generated in /output/yolov6_evaluation_output
  • By default, it evaluates test images

Training

NOTE: All scripts executed from /workspace inside docker

# Preprocess Theme 1 dataset 
bash preprocess_data.sh

# Train Yolo
bash train_yolov6.sh

# Evaluate Yolo on train images
bash evaluate_yolov6_for_diffusion.sh

# Train Diffusion
bash train_diffusion.sh

Challenges during Data preparation

  • Annotations were noisy by design which made the Object Detection process very challenging.
  • Adding TTA (Test-Time Augmentation) to both Yolo and Diffusion model evalutaion and image transformations to training reduced the error rate.

Towards Future Scalability

  • The proposed framework is automated and scalable to large datasets.
  • Optimizing the inference stage for both Yolov6 and Diffusion using acceleration frameworks like TensorRT and ONNX would be required to make this approach deployable.
  • Distillation to smaller model sizes would also be crucial in deployment.

Future direction

I would focus on the following areas of improvement:

  • Adding diffusion denoising to Yolo training directly. My current setup is a 2-stage approach which likely causes performance degradation by not optimizing end-2-end.
  • RLHF (Reinforcement Learning from Human Feedback) has shown great promise in language and image generation to align model outputs with human preference. This approach could be useful in aligning the object detection models for noisy datasets. A reward model can be created using only a small amount of Feedback data and can scale to large datasets and help with model generality.

Open Source Software

sdaia_hack_theme1's People

Contributors

sahajgg 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.