{"id":20805458,"url":"https://github.com/akhilkailas017/object-detection-using-yolov5","last_synced_at":"2025-05-07T04:23:25.761Z","repository":{"id":133719018,"uuid":"514626382","full_name":"akhilkailas017/Object-Detection-using-Yolov5","owner":"akhilkailas017","description":"This repository teaches you how to train your own image dataset using yolov5 model. To know more download the rar file in this repository and extract it.","archived":false,"fork":false,"pushed_at":"2022-08-02T04:56:37.000Z","size":6887,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-31T06:21:45.574Z","etag":null,"topics":["ai","artificial-intelligence","detection","detector","image-processing","labelimg","object","object-detection","python","python3","pytorch","ultralytics","yolo","yolov5"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/akhilkailas017.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2022-07-16T16:13:20.000Z","updated_at":"2024-02-20T15:01:22.000Z","dependencies_parsed_at":"2023-09-17T11:05:49.359Z","dependency_job_id":null,"html_url":"https://github.com/akhilkailas017/Object-Detection-using-Yolov5","commit_stats":null,"previous_names":["akhilkailas017/object-detection-using-yolov5"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akhilkailas017%2FObject-Detection-using-Yolov5","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akhilkailas017%2FObject-Detection-using-Yolov5/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akhilkailas017%2FObject-Detection-using-Yolov5/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akhilkailas017%2FObject-Detection-using-Yolov5/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/akhilkailas017","download_url":"https://codeload.github.com/akhilkailas017/Object-Detection-using-Yolov5/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252811233,"owners_count":21807911,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","artificial-intelligence","detection","detector","image-processing","labelimg","object","object-detection","python","python3","pytorch","ultralytics","yolo","yolov5"],"created_at":"2024-11-17T19:14:52.633Z","updated_at":"2025-05-07T04:23:25.734Z","avatar_url":"https://github.com/akhilkailas017.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Object-Detection-using-Yolov5\n\n## Yolov5 Custom Dataset Training\n\n\n**Dataset Creation**\n\n- collect images for custom dataset training.(size and resolution of the image dosent matter)\n- install python using https://www.python.org/downloads/\n- open command prompt and install lxml by typing \"pip install lxml\"\n- open command prompt and install PyQt5 by typing \"pip install PyQt5\" or \"pip3 install PyQt5\"\n- open labelImg folder in command prompt and type \"python labelImg.py\" for open labelImg.(labelImg is used for annotating the images)\n- in labelImg open collected image directory and start annotating the images using create rectbox tool and mention class name after that save all annotation in pascalvoc format.\n- after completing annotation copy all xml file to convert folder in \\xml_to_yolo_convert\\convert location.\n- then edit convert.py file.edit the class name in these lines with our class names(like \"accessory,\"top\",\"rubber\" etc the class name given in the time of annotation) and remove unwanted classes\n- save convert.py file\n- then open command prompt in that convert folder and type \"python convert.py\" this will create yolo text file(.txt) for the xml file\n\n**Seperating Dataset for train and validation**\n\n- for training we need 80% of images we collected and for validation the remaining 20% image needed ( train=80% and validation=20% ).\n- copy 80% of images from dataset to train folder in location dataset\\images\\train\n- copy corresponding yolo file of the image used for train to location dataset\\labels\\train\n- copy remaining images from dataset to validation folder in location dataset\\images\\val\n- copy corresponding yolo file of the image used for validation to location dataset\\labels\\val\n\n**Yaml file editing**\n\n- open the folder data in yolov5\\data and open custom_dataset.yaml in notpad.\n- change the value of nc to the no of classes present in our dataset\n- replace the classnames with our class names\n- save the file\n\n**Yolov5 training and detecting**\n\n- open command prompt in folder yolov5 then type \"pip install -r requirements.txt\" for installing requirement for yolov5\n- for training open command prompt in folder yolov5 then type \"python train.py --img 640 --batch 16 --epochs 100 --data custom_dataset.yaml --weights yolov5s.pt --cache\"\n- after training it will create weight in folder yolov5/runs/train/exp/weights/best.pt\n- for detecting images copy some images for testing in folder yolov5\\data\\images\n- open command prompt in folder yolov5 then type \"python detect.py --source data/images/ --weights runs/train/exp/weights/best.pt\"\n- after completing detection it gives results in folder yolov5/runs/detect\n\n**Keywords used in Yolov5**\n\n- batch — batch size (-1 for auto batch size). Use the largest batch size that your hardware allows for.\n- epochs — number of epochs.\n- data — path to the data-configurations file.\n- cfg — path to the model-configurations file.\n- weights — path to initial weights.\n- cache — cache images for faster training.\n- img — image size in pixels (default — 640).\n- source — input path (0 for webcam)\n- conf — confidence threshold\n- iou — IoU threshold for NMS (Non Max Supression)\n- augment — augmented inference (TTA)\n\n**Create Virtual Environment for python ( optional )**\n\n- download and install python\n- create a folder in our local disk\n- open newely created folder in command prompt\n- type \"python -m venv virtual_environment_name\" in the place of virtual_environment_name we can give our own virtual environment name by replacing it\n- type \"virtual_environment_name\\Scripts\\activate\" for activating the virtual environment\n- type \"deactivate\" for deactivating virtual environment\n- if pip not showing in virtual folder type \"python -m ensurepip\" then upgrade pip\n\n**Yolo Commands**\n\n- python train.py --img 415 --batch 16 --epochs 30 --data dataset.yaml --weights yolov5s.pt --cache\n- python train.py --img 640 --batch 8 --epochs 100 --data mat.yaml --weights yolov5s.pt --cache\n- python detect.py --source data/images/ --weights runs/train/exp/weights/best.pt\n- python detect.py --source data/images/ --weights runs/train/exp/weights/best.pt --conf 0.50\n- python export.py --data mat.yaml --weights runs/train/exp/weights/best.pt --include tflite --img 640\n- python detect.py --weights runs/train/exp/weights/best-fp16.tflite --img 640 --source data/images/\n\n**References**\n\n- python : https://www.python.org/downloads/\n- labelImg : https://github.com/tzutalin/labelImg\n- xml to yolo converter : https://github.com/bjornstenger/xml2yolo\n- yolov5 : https://github.com/ultralytics/yolov5\n- labelimg annotation tutorial : https://youtu.be/Tlvy-eM8YO4\n- yolov5 training tutorial : https://youtu.be/80Q3HIBy7Qg\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakhilkailas017%2Fobject-detection-using-yolov5","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fakhilkailas017%2Fobject-detection-using-yolov5","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakhilkailas017%2Fobject-detection-using-yolov5/lists"}