Coder Social home page Coder Social logo

ruhyadi / yolo3d Goto Github PK

View Code? Open in Web Editor NEW
222.0 5.0 40.0 24.81 MB

YOLO 3D Object Detection for Autonomous Driving Vehicle

Home Page: https://ruhyadi.github.io/project/computer-vision/yolo3d

Dockerfile 0.36% Shell 0.66% Python 98.46% HTML 0.51%
yolo self-driving-car 3d-object-detection pytorch deep-learning

yolo3d's Introduction

YOLO For 3D Object Detection

Note

I have created a new repository of improvements of YOLO3D wrapped in pytorch lightning and more various object detector backbones, currently on development. Please check ruhyadi/yolo3d-lightning.

Unofficial implementation of Mousavian et al in their paper 3D Bounding Box Estimation Using Deep Learning and Geometry. YOLO3D uses a different approach, as the detector uses YOLOv5 which previously used Faster-RCNN, and Regressor uses ResNet18/VGG11 which was previously VGG19.

inference

Installation

For installation you can use virtual environment like anaconda or using docker image. For anaconda follow:

Ananconda Virtual Env

Create conda environment

conda create -n yolo3d python=3.8 numpy

Install PyTorch and torchvision version 1.8 above. If your GPU doesn't support it, please follow Nelson Liu blogs.

pip install torch==1.8.1 torcvision==0.9.1

Last, install requirements

pip install -r requirements.txt

Docker Engine

Docker engine is easy way to install all you need. Pull docker image from repository:

docker pull ruhyadi/yolo3d:latest

run docker container from docker image with

cd ${YOLO3D_DIR}
./runDocker.sh

You will get in to docker container interactive terminal. You can run inference code or flask app, follow code below.

Download Pretrained Weights

In order to run inference code or resuming training, you can download pretrained ResNet18 or VGG11 model. I have train model with 10 epoch each. You can download model with resnet18 or vgg11 for --weights arguments.

cd ${YOLO3D_DIR}/weights
python get_weights.py --weights resnet18

Inference

For inference with pretrained model you can run code below. It can be run in conda env or docker container.

python inference.py \
    --weights yolov5s.pt \
    --source eval/image_2 \
    --reg_weights weights/resnet18.pkl \
    --model_select resnet18 \
    --output_path runs/ \
    --show_result --save_result

Inference can be run on Colab Notebook, please visit this link.

Training

YOLO3D model can be train with PyTorch or PyTorch Lightning. In order to train you need API KEY for comet.ml (visualize your training loss/accuracy). Follow comet.ml documentation to get API key.

python train.py \
    --epochs 10 \
    --batch_size 32 \
    --num_workers 2 \
    --save_epoch 5 \
    --train_path ./dataset/KITTI/training \
    --model_path ./weights \
    --select_model resnet18 \
    --api_key xxx

In order train with pytorch lightning run code below:

!python train_lightning.py \
    --train_path dataset/KITTI/training \
    --checkpoint_path weights/checkpoints \
    --model_select resnet18 \
    --epochs 10 \
    --batch_size 32 \
    --num_workers 2 \
    --gpu 1 \
    --val_split 0.1 \
    --model_path weights \
    --api_key xxx

Reference

@misc{mousavian20173d,
      title={3D Bounding Box Estimation Using Deep Learning and Geometry}, 
      author={Arsalan Mousavian and Dragomir Anguelov and John Flynn and Jana Kosecka},
      year={2017},
      eprint={1612.00496},
      archivePrefix={arXiv},
      primaryClass={cs.CV}
}

yolo3d's People

Contributors

ruhyadi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

yolo3d's Issues

How to train custom dataset ?

Great work on 3d object detection , could you please help me to create and train a custom dataset , Thanking you in advance.

cuda problem when tying to inference

File "inference.py", line 285, in
main(opt)
File "inference.py", line 273, in main
detect3d(
File "inference.py", line 71, in detect3d
regressor = regressor_factorymodel_select.cuda()
File "C:\Users\yalyz\miniconda3\envs\yolo3d\lib\site-packages\torch\nn\modules\module.py", line 491, in cuda
return self._apply(lambda t: t.cuda(device))
File "C:\Users\yalyz\miniconda3\envs\yolo3d\lib\site-packages\torch\nn\modules\module.py", line 387, in _apply
module._apply(fn)
File "C:\Users\yalyz\miniconda3\envs\yolo3d\lib\site-packages\torch\nn\modules\module.py", line 387, in _apply
module._apply(fn)
File "C:\Users\yalyz\miniconda3\envs\yolo3d\lib\site-packages\torch\nn\modules\module.py", line 409, in _apply
param_applied = fn(param)
File "C:\Users\yalyz\miniconda3\envs\yolo3d\lib\site-packages\torch\nn\modules\module.py", line 491, in
return self.apply(lambda t: t.cuda(device))
File "C:\Users\yalyz\miniconda3\envs\yolo3d\lib\site-packages\torch\cuda_init
.py", line 164, in _lazy_init
raise AssertionError("Torch not compiled with CUDA enabled")
AssertionError: Torch not compiled with CUDA enabled
i tried it on a computer with and without cude and still faced the same issue

Training using Kitti Dataset

Hi, I just like to ask how I can train using the Kitti Dataset? I understand that the label from there is not necessarily the right label format to use here? I need to train a new model using the YOLO3D Training Script. Many thanks!

demo msib

demo widya for training with pytorch lightning

Trouble with "get_weights.py". Access denied.

Hello Didi @ruhyadi!

Great work on this implentation of YOLO!

I was trying out this repo and came across a broken link when trying to get the weights for this implementation.

Here's the full error from my docker container:

root@712405c3abe2:/yolo3d/weights# python3 get_weights.py --weights resnet18
Access denied with the following error:

        Cannot retrieve the public link of the file. You may need to change
        the permission to 'Anyone with the link', or have had many accesses. 

You may still be able to access the file from the browser:

         https://drive.google.com/uc?id={weights_list[weights]}

Do I need to be trying to access the drive link from the browser? Is there another way people can download the weights?

Thanks in advance, and once again, great work!

Neil

Operating System: Kubuntu 22.04
KDE Plasma Version: 5.24.7
KDE Frameworks Version: 5.92.0
Qt Version: 5.15.3
Kernel Version: 5.19.0-40-generic (64-bit)
Graphics Platform: X11
Processors: 32 × AMD Ryzen 9 5950X 16-Core Processor
Memory: 31.3 GiB of RAM
Graphics Processor: NVIDIA GeForce RTX 3090/PCIe/SSE2

Pip error at installation

When you want to install the needed packages over the reqirements.txt will an error arise.

pytorch-lightning

You need the version 1.6.4 of pytorch-lightning to successfully install requirements.

pytorch-lightning==1.6.4

Converting script

Do you have any conventional script that can be used to convert raw kitti data (download with this script) to your training format? Currently I am using this format and it's fine. Btw why did you use a global calib_cam_to_cam.txt? I can see that there is one calib_cam_to_cam.txt for each "date" index.

YOLOv7 Integration

Hi,

I checked your inference.py script and noticed the inclusion of a yolov5 .pt file for the 2D object detector weights. I wish to know if I can just plug in a weights file that was trained on the yolov7 architecture?

Many Thanks!

FileNotFoundError !

FileNotFoundError: [Errno 2] No such file or directory: '/content/drive/MyDrive/3d_det/ACP_3Detection/YOLO3D/dataset/KITTI/training/calib/', please anyone help me to debug , Thanking you in advance.

Data path problem

I don't know what missing file keeps reporting errors:
FileNotFoundError: [2] Errno No to the file or directory: 'the dataset/KITTI/training/label_2 /. txt ",
I want to know the format of the data and path, hope to get more information

3d inference result problem

i have rewrite the code to CPP so the YOLO3D can runs on nVidia Jetson NX Xavier, but in the car class, sometimes the inference result is not good, I think this problem is caused by least squares linear regression(numpy api: np.linalg.lstsq in Math.py), is there any better algorithms to improve this problem? or if is necessary to change the cam_to_file(camera calib file) to my own camera?

the result is same as #13

Typo at README.md

Command in README.md

pip install torch==1.8.1 torcvision==0.9.1

should be

pip install torch==1.8.1 torchvision==0.9.1

Inference speed

First of all, I want to say that I really appreciate your work.

  • I see in inference.py that at each time we predict an image, we have to init an instance of DetectMultiBackend. I think it will slow down your inference code when you want to infer many images.
  • You can speed up your inference code by predicting a batch of images instead of predicting a single image.

Pip error at installation

in your code README.md installation
pip install torch==1.8.1 torcvision==0.9.1
which gets : ERROR: Could not find a version that satisfies the requirement torcvision==0.9.1 (from versions: none)
ERROR: No matching distribution found for torcvision==0.9.1
its spost to be:
pip install torchvision==0.9.1

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.