An open API service indexing awesome lists of open source software.

https://github.com/hasanulmukit/ai-smart-factory-optimization

An AI/ML system designed to optimize smart factory operations by streamlining production lines, reducing waste, and automating material recycling.
https://github.com/hasanulmukit/ai-smart-factory-optimization

artificial-intelligence machine-learning recycling streamlit waste-classification

Last synced: 11 months ago
JSON representation

An AI/ML system designed to optimize smart factory operations by streamlining production lines, reducing waste, and automating material recycling.

Awesome Lists containing this project

README

          

## Smart Factory Optimization with Automated Material Recycling

**Repository Overview**

This project implements an AI/ML system designed to optimize smart factory operations by streamlining production lines, reducing waste, and automating material recycling. Leveraging state-of-the-art deep learning models and advanced data processing tools, this repository guides you through every step—from data collection and preprocessing to model training, inference, and dashboard deployment using Streamlit.

---

## Table of Contents

* [Features](#features)
* [System Architecture](#system-architecture)
* [Prerequisites](#prerequisites)
* [Installation](#installation)
* [Project Structure](#project-structure)
* [Data Preparation](#data-preparation)
* [Model Training](#model-training)
* [Inference Pipeline](#inference-pipeline)
* [Streamlit Dashboard](#streamlit-dashboard)
* [Advanced Data Processing with DeepSeek](#advanced-data-processing-with-deepseek)
* [Testing and Optimization](#testing-and-optimization)
* [Deployment](#deployment)
* [Contributing](#contributing)
* [License](#license)
* [Acknowledgments](#acknowledgments)

---

## Features

* **Image-based Waste Classification:** Uses transfer learning on EfficientNet to classify recyclable vs. non-recyclable materials.
* **Data Augmentation:** On-the-fly augmentation to improve model robustness.
* **Automated Inference Pipeline:** Real-time image ingestion and classification.
* **Interactive Dashboard:** Streamlit app for uploading images, visualizing predictions, and monitoring performance metrics.
* **DeepSeek Integration:** Advanced data processing and report generation on production metrics.
* **Extensible Design:** Easily swap model architectures or integrate object detection frameworks like YOLO.

---

## System Architecture

```plaintext
+---------------------+ +----------------------+ +--------------------+
| Production Line Cam | --> | Inference Pipeline | --> | Automated Sorting |
+---------------------+ +----------------------+ +--------------------+
| ^
v |
+----------------------+ +----------------------+ |
| Data Collection | | Model Training |-----------------+
+----------------------+ +----------------------+ |
| |
v v
+----------------------+ +----------------------+ +----------------+
| DeepSeek Reporting |<-- | Streamlit Dashboard | | Visualization |
+----------------------+ +----------------------+ +----------------+
```

---

## Prerequisites

* Python 3.8+
* Kaggle or Google Colab for model training (with GPU runtime)
* VS Code for local development
* Streamlit for dashboard
* Git for version control

---

## Installation

1. Clone the repository:

```bash
git clone https://github.com/yourusername/smart-factory-recycling.git
cd smart-factory-recycling
```

2. (Optional) Create and activate a virtual environment:

```bash
python3 -m venv env
source env/bin/activate # macOS/Linux
env\Scripts\activate.bat # Windows
```

3. Install dependencies:

```bash
pip install -r requirements.txt
```

---

## Project Structure

```plaintext
smart-factory-recycling/
├── dataset/ # Raw and processed images
├── data_preprocessing.py # Data loading & augmentation
├── model_training.py # Model definition & training loop
├── inference.py # Inference utilities
├── dashboard.py # Streamlit dashboard
├── deep_insights.py # DeepSeek integration scripts
├── requirements.txt # Python dependencies
├── best_model.h5 # Saved best model weights
└── README.md # Project documentation
```

---

## Data Preparation

1. **Organize Dataset:** Place images in `dataset//` directories (e.g., `dataset/recyclable/`, `dataset/non_recyclable/`).
2. **Run Preprocessing:**

```bash
python data_preprocessing.py
```
3. **Inspect Augmentations:** The script visualizes sample augmentations to verify correctness.

---

## Model Training

1. **Configure Hyperparameters:** Modify constants in `model_training.py` (e.g., `IMG_HEIGHT`, `BATCH_SIZE`, `EPOCHS`).
2. **Train Model on Kaggle/Colab:**

* Upload scripts and dataset to Colab.
* Enable GPU runtime.
* Run:

```bash
python model_training.py
```
3. **Best Model:** Training checkpoints and the best-performing model will be saved as `best_model.h5`.

---

## Inference Pipeline

Use `inference.py` to load the trained model and classify new images:

```bash
python inference.py --image path_to_image.jpg
```

This script outputs the predicted class and confidence score. Integrate with the factory camera feed for real-time classification.

---

## Streamlit Dashboard

Launch the interactive dashboard to upload images and visualize predictions:

```bash
streamlit run dashboard.py
```

Features:

* Image uploader
* Real-time classification display
* Confidence visualization

---

## Advanced Data Processing with DeepSeek

If you have access to DeepSeek:

```bash
python deep_insights.py --csv production_data.csv
```

This generates a comprehensive report on throughput, waste metrics, and optimization suggestions.

---

## Testing and Optimization

* **Local Testing:** Validate the inference pipeline with sample images.
* **Fine-Tuning:** Unfreeze top layers of EfficientNet for additional training.
* **Quantization:** Use TensorFlow Lite for edge deployment.
* **Batch Processing:** Optimize throughput by processing images in batches or asynchronously.

---

## Deployment

* **REST API (Optional):** Wrap inference in FastAPI:

```bash
uvicorn api:app --host 0.0.0.0 --port 8000
```
* **Docker:** Containerize the app for scalable deployment.
* **Cloud Services:** Deploy on AWS EC2, GCP Compute Engine, or Azure VM.

---

## Contributing

Contributions are welcome! Please follow these steps:

1. Fork the repository
2. Create a feature branch (`git checkout -b feature-name`)
3. Commit your changes (`git commit -m 'Add feature'`)
4. Push to the branch (`git push origin feature-name`)
5. Open a Pull Request

---

## License

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

---

## Acknowledgments

* [TrashNet Dataset](https://github.com/garythung/trashnet) for waste classification data
* TensorFlow & Keras for deep learning APIs
* Streamlit for rapid dashboard development
* DeepSeek for advanced data analytics

---

Happy optimizing!