{"id":30838681,"url":"https://github.com/ninenights195/smart-traffic-light","last_synced_at":"2025-10-13T19:34:12.856Z","repository":{"id":310260535,"uuid":"1039041738","full_name":"NineNights195/smart-traffic-light","owner":"NineNights195","description":"This is mini project that I made for DEPA Coding 2025 competitive","archived":false,"fork":false,"pushed_at":"2025-08-27T09:14:32.000Z","size":5856,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-06T18:23:41.134Z","etag":null,"topics":["edge-ai","python-3"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NineNights195.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-08-16T10:59:46.000Z","updated_at":"2025-08-27T09:40:04.000Z","dependencies_parsed_at":"2025-08-16T22:13:14.206Z","dependency_job_id":"a48bcabc-265f-4da5-befd-40696dd94407","html_url":"https://github.com/NineNights195/smart-traffic-light","commit_stats":null,"previous_names":["ninenights195/smart-traffic-light"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/NineNights195/smart-traffic-light","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NineNights195%2Fsmart-traffic-light","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NineNights195%2Fsmart-traffic-light/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NineNights195%2Fsmart-traffic-light/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NineNights195%2Fsmart-traffic-light/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NineNights195","download_url":"https://codeload.github.com/NineNights195/smart-traffic-light/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NineNights195%2Fsmart-traffic-light/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279016917,"owners_count":26085888,"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","status":"online","status_checked_at":"2025-10-13T02:00:06.723Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["edge-ai","python-3"],"created_at":"2025-09-06T18:05:26.484Z","updated_at":"2025-10-13T19:34:12.844Z","avatar_url":"https://github.com/NineNights195.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🚦 Smart Traffic Light\n### 💻 The Project for Coding Thailand 2025 - Regional Competition\nThis project is built for the Coding Thailand 2025 - Regional Competition to simulate and use AI to solve traffic problems.\n\nUsing Python and a webcam, the system employs the advanced YOLOv8 (nano version) object detection model to:\n- Count persons and vehicles in real time at an intersection.\n- Change traffic lights based on what it detected (person is top priority).\n\nThe goals for this project are to qualify for the **National round** and to practice my Python skills at the same time. When I enter the national round, I will make the Raspberry Pi version. However, the AI may have issues detecting persons and vehicles and needs improvement in the future.\n\n---\n\n## 🛠️ Requirements\n- Linux (Ubuntu/Debian recommended) or Windows with Python installed\n- Python **3.12 or 3.13**\n- Webcam or external camera\n- Git\n\n---\n\n## ⚙️ Setup instruction\n\n### 1. **Clone the Repository**\n  - Clone default branch (main):\n    ```\n    git clone https://github.com/NineNights195/smart-traffic-light.git\n    ```\n  - To clone specific branch:\n    ```\n    git clone -b \u003cbranch-name\u003e https://github.com/NineNights195/smart-traffic-light.git\n    ```\n\n### 2. **Create Virtual Environment**\n  - Go to your repo\n    ```\n    cd \u003cyour repo directory\u003e\n    ```\n  - Create virtual enviroment to avoids messing up system Python\n    ```\n    python -m venv venv\n    ```\n\n### 3. **Activate Virtual Environment**\n  - Windows:\n    ```bash\n    .\\venv\\Scripts\\activate\n    ```\n  - macOS/Linux:\n    ```bash\n    source venv/bin/activate\n    ```\n\n### 4. Ensure pip is avaliable\n  - If pip is missing inside the venv, run:\n    ```\n    python -m ensurepip --upgrade\n    ```\n\n### 5. Upgrade pip, setuptools, and wheel\n```\npip install --upgrade pip setuptools wheel\n```\n\n### 6. **Install Dependencies**\n  ```bash\n  pip install -r requirements.txt\n  ```\n  - Requirements dependencies\n    ```\n    opencv-python\n    numpy\n    torch\n    torchaudio\n    torchvision\n    ultralytics\n    ultralytics-thop\n    pandas\n    pillow\n    tqdm\n    ```\n\n### 7. Download YOLO model\n- Create a folder called models inside your project (if it doesn’t exist yet):\n  ```\n  mkdir -p models\n  ```\n- Download the YOLOv8 nano model (yolov8n.pt) into the models/ directory:\n  ```\n  wget -O models/yolov8n.pt https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8n.pt\n  ```\n  Alternatively, if wget is not available, use curl:\n  ```\n  curl -L -o models/yolov8n.pt https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8n.pt\n  ```\n\n### 8. Test some scripts\n- Now you can test some scripts in scripts folder\n- Example the webcam-test.py\n  ```\n  python webcam-test.py\n  ```\n  Now it should work properly\n  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fninenights195%2Fsmart-traffic-light","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fninenights195%2Fsmart-traffic-light","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fninenights195%2Fsmart-traffic-light/lists"}