{"id":20171671,"url":"https://github.com/valeriospagnoli/eyeroad","last_synced_at":"2025-04-10T02:43:49.815Z","repository":{"id":191950833,"uuid":"672324033","full_name":"ValerioSpagnoli/EyeRoad","owner":"ValerioSpagnoli","description":"Vehicles and plate detection and tracking with string plate recognition.","archived":false,"fork":false,"pushed_at":"2024-10-06T21:08:30.000Z","size":31441,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-24T04:14:05.786Z","etag":null,"topics":["artificial-intelligence","computer-vision","faster-rcnn","license-plate-detection","license-plate-recognition","neural-network","object-detection","opencv","plate-detection","plate-recognition","pytorch","vehicle-detection"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ValerioSpagnoli.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-29T17:22:22.000Z","updated_at":"2025-02-04T02:41:18.000Z","dependencies_parsed_at":"2023-09-01T17:42:50.098Z","dependency_job_id":"c05b2178-a05e-448b-ba09-b9a1790d27a1","html_url":"https://github.com/ValerioSpagnoli/EyeRoad","commit_stats":{"total_commits":29,"total_committers":3,"mean_commits":9.666666666666666,"dds":0.06896551724137934,"last_synced_commit":"4be83875c25e2e41ad41d8fe1dc89a0e46b0e73c"},"previous_names":["valeriospagnoli/vehiclesandplates-detector","valeriospagnoli/eyeroad"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ValerioSpagnoli%2FEyeRoad","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ValerioSpagnoli%2FEyeRoad/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ValerioSpagnoli%2FEyeRoad/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ValerioSpagnoli%2FEyeRoad/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ValerioSpagnoli","download_url":"https://codeload.github.com/ValerioSpagnoli/EyeRoad/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248145454,"owners_count":21055132,"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":["artificial-intelligence","computer-vision","faster-rcnn","license-plate-detection","license-plate-recognition","neural-network","object-detection","opencv","plate-detection","plate-recognition","pytorch","vehicle-detection"],"created_at":"2024-11-14T01:26:33.846Z","updated_at":"2025-04-10T02:43:49.793Z","avatar_url":"https://github.com/ValerioSpagnoli.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# EyeRoad: Vehicles and plates detector and tracking with string plate recognition\n\nThis repository contain the project for Vision and Perception exam of Master in Artificial in Intelligence and Robotics from **University La Sapienza of Rome**.\n\nThe string plate recognition part of this project has been developed and uploaded by **[Luigi Gallo](https://github.com/luigi-ga)**, **co-worker of this project**, on the following repository https://github.com/luigi-ga/ALPRNet.git.\n\n## Visuals\n\n![Alt Text](media/demo.gif)\n\nFrom this [link](https://drive.google.com/file/d/14FUnilJ6lGWAUMs6i-etV0Tw7AkkKlH2/view?usp=share_link) you can download the full demo video.\n\n## Description\n\nThe project implements the following features:\n\n- object detector of vehicles and plates based on [FasterRCNN_ResNet50](https://pytorch.org/vision/main/models/generated/torchvision.models.detection.fasterrcnn_resnet50_fpn.html) of PyTorch:\n  - By Shaoqing Ren, Kaiming He, Ross Girshick, Jian Sun, \"Faster R-CNN: Towards Real-Time Object Detection with Region Proposal Networks\". [[PDF](https://arxiv.org/pdf/1506.01497.pdf)]\n- string plate recognition based on ALPRNet (imported as sub-module from https://github.com/luigi-ga/ALPRNet.git)\n- tracking and counting of vehicles based on string plate recognition\n- velocity estimation based on domain knowledge\n\nThe following **pseudocode** shows the inference stage of this project with reference to ``real_time_object_detector.py`` file.\n\nThe training stage is not explained here, but if you are interested check the following files: ``dataset.py``, ``model.py``, ``training.py`` and ``notebook.py``:\n\n- in ``dataset.py`` there are classes and functions used to import dataset and create dataloaders\n- in ``model.py`` there is the import of the pretrained model from PyTorch\n- in ``training.py`` there is the training procedure\n\nThe file ``notebook.py`` was used as main to perform both training and inference.\n\n```python\nfor frame in video:\n  \n  # use the FasterRCNNResNet50 model in inference mode to perform object detection of \n  # vehicles and plates using the frame image\n  bounding_boxes_vehicles_and_plates = FasterRCNNResNet50(frame)\n\n  # discard all bounding boxes of plates and apply non-maximum-suppresion and \n  # score-thresholding on bounding boxes of vehicles\n  bounding_boxes_vehicles = decode_preditcion_vehicles(bounding_boxes_vehicles_and_plates)\n\n  for bounding_box_vehicle in bounding_boxes_vehicles:\n\n    # crop the image of vehicle using the bounding box\n    cropped_vehicle = frame[bounding_box_vehicle]\n\n    # use the FasterRCNNResNet50 model in inference mode to perform object detection of \n    # vehicles and plates using the cropped image\n    bounding_boxes_vehicles_plates = FasterRCNNResNet50(cropped_vehicle)\n\n    # discard all bounding boxes of vehicles (there should be no bb of vehicles at \n    # this stage) and extraxt the bounding box of the plate with the highest score, \n    # applying score-thresholding\n    bounding_box_plate = decode_prediction_plates(bounding_boxes_vehicles_plates)\n\n    # crop the image of plate using the bounding box\n    cropped_plate = cropped_vehicle[bounding_box_plate]\n  \n    # apply super resolution model on cropped plate to obtain a better image\n    sr_cropped_plate = EDSR(cropped_plate)\n\n    # transfrom the sr_cropped_plate in a gray image\n    gray_sr_cropped_plate = to_gray(sr_cropped_plate)\n\n    # use ALPRNet model in inference mode to extract the string of the plate\n    plate_string = ALPRNet(gray_sr_cropped_plate)\n\n    # use the plate string to perform tracking on the vehicle with that plate\n    idx = tracking(plate_string, bounding_box_vehicle)\n\n    # detect the velocity of this vehicle\n    velocity_detected = velocity_detector(idx, bounding_box_vehicle)\n```\n\nFor the super resolution of the plate was used the EDSR model implemented in OpenCV:\n\n- Bee Lim, Sanghyun Son, Heewon Kim, Seungjun Nah, and Kyoung Mu Lee, \"Enhanced Deep Residual Networks for Single Image Super-Resolution,\" 2nd NTIRE: New Trends in Image Restoration and Enhancement workshop and challenge on image super-resolution in conjunction with CVPR 2017. [[PDF](https://arxiv.org/pdf/1707.02921.pdf)]\n- [Official repository GitHub](https://github.com/sanghyun-son/EDSR-PyTorch)\n- [OpenCV documentation](https://docs.opencv.org/4.x/d8/d11/classcv_1_1dnn__superres_1_1DnnSuperResImpl.html)\n\n## Directory tree\n\n```sh\nEyeRoad\n└── src\n    ├── ALPRNet (sub-module)\n    ├── modules\n    │   ├── dataset.py\n    │   ├── detect_plate_string.py\n    │   ├── inference.py\n    │   ├── model.py\n    │   ├── real_time_object_detector.py\n    │   └── training.py\n    ├── utils\n    │   └── frames_to_video.py \n    ├── notebook.ipynb\n    └── test.py\n```\n\n## Installation\n\n1. Clone this repository:\n\n```sh\ngit clone --recurse-submodules https://github.com/ValerioSpagnoli/EyeRoad.git\ncd EyeRoad\n```\n\n2. Install the required dependencies using `pip`:\n\n```sh\npip install -r requirements.txt\n```\n\n## Usage\n\nDownload the weights following the instructions in [Download weights](#download-weights).\n\nFrom this [link](https://drive.google.com/file/d/1yx1Ou7iClEo5t-Ki9wWFVcgR7iKx_UbN/view?usp=share_link) download the test video, and put it into a folder named ``video_test`` in the main directory of this repository. The directory three must be:\n\n```sh\nEyEroad\n└── src\n│   └── ...\n└── video_test\n    └── video_test.mp4\n```\n\nIf you want use a different video open ``test.py`` and change the parameter ``video_path`` of the function ``real_time_object_detector`` with the path of your video.\nThen, launch the following command from the main directory of this repository:\n\n```sh\npython src/test.py\n```\n\n## Download weights\n\nThis project use three networks:\n\n- Faster-RCNN-ResNet50 for object detection\n- EDSR for super resolution\n- ALPRNet for string plate recognition\n\nFrom this [link](https://drive.google.com/drive/folders/1FC2Lk9JyoFW2zNLKumSbIV2qNtT79qlS?usp=sharing) you can download three folders with all weights needed. Please create a folder named ``weights`` in the main directory of this repository and put all three folders downloaded into it. The directory tree must be:\n\n```sh\nEyeRoad\n└── src\n│   └── ...\n└── weights\n    ├── alpr_weights\n    ├── detector_weights\n    └── edsr_weights\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvaleriospagnoli%2Feyeroad","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvaleriospagnoli%2Feyeroad","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvaleriospagnoli%2Feyeroad/lists"}