Skip to content

This project was created as part of Intel UNNATI Project. The topic of our project was "Road Object Detection Using Deep Learning".

License

Notifications You must be signed in to change notification settings

noel-robert/Road_Object_Detection_Using_DeepLearning

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Intel Unnati Project - Team TRON

Final version of this repository

This project was created as part of Intel UNNATI Industrial Training Project. The topic of our project was "Road Object Detection with Deep Learning".

Our aim was to develop a model that could identify objects specifically in Indian roads. This is because roads in India may be completely different from other countries thus their datasets will not be of much use here.

Procedure to train the model are as follows -

  1. Clone | fork this project.

  2. Download IDD from http://idd.insaan.iiit.ac.in/ [you will be asked to create an account]. IDD Detection (22.8 GB) is the dataset being used in this case.
    - Note that IDD_Detection directory here does not have Annotations and JPEGImages folders due to its large size.

  3. Extract downloaded dataset and place the dataset into cloned directory. This will replace the already present IDD_Detection folder.

  4. In your preferred code editor, navigate to the cloned directory and run the following command in the terminal: python datasetPreprocessing.py. This will create a new folder modified_dataset which is where dataset is stored in the proper format. This process may take around 20 minutes, depending on your system configuration.

  5. Clone YOLOv5 GitHub repository into your directory. Instructions for installation can be found in the repository.
    Optional: Create a virtual environment before running pip install -r requirements.txt so as to not interfere with any other versions which may be already installed in your system.

  6. In yolov5/data, create a new file named idd.yaml and place the following into the file

    # Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
    path: ../modified_dataset   # dataset root dir
    train: images/train         # train images (relative to 'path') 128 images
    val: images/val             # val images (relative to 'path') 128 images
    test: images/test           # test images (optional)
    nc: 15                      # number of classes
    
    names: ['car', 'bus', 'autorickshaw', 'vehicle fallback', 'truck', 'motorcycle', 'rider', 'person', 'bicycle', 'animal', 'traffic sign', 'train', 'trailer', 'traffic light', 'caravan']
  7. In yolov5/models, there are different models thet can be trained. Choose the one based on requirements. Before using model, confirm that 'nc' i.e., number of classes, is same as in idd.yaml.

  8. Run the model using the command

    python train.py --img <image_size> --batch <batch_size> --epochs <num_epochs> --data <data/data.yaml> --cfg <path_to_model_config>

    add '--device cuda:0' if you are using a dedicated GPU (please do check if your GPU supports CUDA). Also try installing cuDNN, but a NVIDIA Developer Program Membership is required

    use '--weights <path_to_weights>' if you have pretrained weights

    optionally, you can set the number of workers with --workers but do take note that workers should not exceed the number of cores your CPU has.

    For example during the first training, the command was:

    python train.py --img 640 --batch 8 --epochs 50 --data data/idd.yaml --cfg models/yolov5s.yaml --device cuda:0 --workers 4
  9. In the second run, yolov5m was used along with pretrained weights:

    note: path to best.pt may be different depending upon iteration

    python train.py --img 640 --batch 8 --epochs 50 --data data/idd.yaml --cfg models/yolov5m.yaml --device cuda:0 --workers 6 --weights runs/train/exp3/weights/best.pt
  10. Results of each training procedure wil present within yolov5/runs/train/exp_no


Results of training operation will be placed in results folder in main directory of the repository for easier review.



Collaborators:
   @Josh-Alex
   @noel-robert
   @nubifathima

About

This project was created as part of Intel UNNATI Project. The topic of our project was "Road Object Detection Using Deep Learning".

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages