{"id":27069151,"url":"https://github.com/sajadtroy/pet-ai","last_synced_at":"2026-02-18T14:36:36.627Z","repository":{"id":256523392,"uuid":"855557554","full_name":"SajadTroy/pet-ai","owner":"SajadTroy","description":"This repository contains code for detecting if a bottle is made of PET (Polyethylene Terephthalate) using a Convolutional Neural Network (CNN) model built with TensorFlow and Keras. It includes scripts for training the model and for using the model to make predictions on new images.","archived":false,"fork":false,"pushed_at":"2024-09-11T04:24:22.000Z","size":29239,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-10T11:38:39.512Z","etag":null,"topics":["ai","artificial-intelligence","opencv","python"],"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/SajadTroy.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":"2024-09-11T04:15:51.000Z","updated_at":"2024-09-11T04:25:05.000Z","dependencies_parsed_at":"2024-09-11T11:02:57.136Z","dependency_job_id":null,"html_url":"https://github.com/SajadTroy/pet-ai","commit_stats":null,"previous_names":["mrsajadpp/pet-ai","sajadtroy/pet-ai"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/SajadTroy/pet-ai","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SajadTroy%2Fpet-ai","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SajadTroy%2Fpet-ai/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SajadTroy%2Fpet-ai/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SajadTroy%2Fpet-ai/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SajadTroy","download_url":"https://codeload.github.com/SajadTroy/pet-ai/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SajadTroy%2Fpet-ai/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279003714,"owners_count":26083610,"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-10T02:00:06.843Z","response_time":62,"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":["ai","artificial-intelligence","opencv","python"],"created_at":"2025-04-05T21:17:07.670Z","updated_at":"2025-10-10T11:38:40.611Z","avatar_url":"https://github.com/SajadTroy.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PET Bottle Detection\n\nThis repository contains code for detecting if a bottle is made of PET (Polyethylene Terephthalate) using a Convolutional Neural Network (CNN) model built with TensorFlow and Keras. It includes scripts for training the model and for using the model to make predictions on new images.\n\n## Table of Contents\n\n- [Features](#features)\n- [Prerequisites](#prerequisites)\n- [Installation](#installation)\n- [Training the Model](#training-the-model)\n- [Using the Model](#using-the-model)\n- [File Structure](#file-structure)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Features\n\n- **Model Training**: Build and train a CNN to classify PET vs. non-PET bottles.\n- **Model Inference**: Use the trained model to predict whether a given bottle is made of PET.\n- **Image Preprocessing**: Includes data augmentation and preprocessing for robust training.\n\n## Prerequisites\n\nEnsure you have the following installed:\n\n- Python 3.x\n- TensorFlow\n- OpenCV\n- NumPy\n- Matplotlib\n\nYou can install the required packages using pip:\n\n```bash\npip install tensorflow opencv-python numpy matplotlib\n```\n\n## Installation\n\n1. Clone the repository:\n\n    ```bash\n    git clone https://github.com/your-username/pet-bottle-detection.git\n    cd pet-bottle-detection\n    ```\n\n2. Install the required packages:\n\n    ```bash\n    pip install -r requirements.txt\n    ```\n\n## Training the Model\n\n1. **Prepare Dataset**: Ensure your dataset is organized as follows:\n\n    ```\n    dataset/\n    ├── train/\n    │   ├── PET/\n    │   └── Non-PET/\n    └── validation/\n        ├── PET/\n        └── Non-PET/\n    ```\n\n2. **Run the Training Script**:\n\n    ```bash\n    python train_model.py\n    ```\n\n    This script will train the CNN model and save it as `pet_bottle_classifier.h5`.\n\n## Using the Model\n\n1. **Ensure Camera is Connected**: Verify that your camera is working and accessible.\n\n2. **Run the Inference Script**:\n\n    ```bash\n    python check_bottle.py\n    ```\n\n    This script will use the trained model to classify bottles captured from the webcam. It will print `1` if the bottle is PET and `0` otherwise.\n\n## File Structure\n\n- `train_model.py`: Script for training the CNN model.\n- `check_bottle.py`: Script for using the trained model to classify bottles.\n- `dataset/`: Directory containing the dataset for training and validation.\n- `requirements.txt`: List of Python dependencies.\n- `pet_bottle_classifier.h5`: The trained model file (generated after training).\n\n## Contributing\n\nContributions are welcome! Please submit issues and pull requests to help improve the project.\n\n1. Fork the repository.\n2. Create a new branch (`git checkout -b feature-branch`).\n3. Make your changes and commit them (`git commit -am 'Add new feature'`).\n4. Push to the branch (`git push origin feature-branch`).\n5. Create a new Pull Request.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsajadtroy%2Fpet-ai","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsajadtroy%2Fpet-ai","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsajadtroy%2Fpet-ai/lists"}