Skip to main content

Overview

The Reciclaje AI model is publicly available on HuggingFace, making it easy to access, download, and integrate into your projects. This page provides guidance on accessing the model and using it in your applications.
HuggingFace Repository: AprendeIngenia/recyclingAI

Accessing the Model

Direct Access

You can access the model directly through the HuggingFace platform:

HuggingFace Model Page

Visit the official model repository on HuggingFace
The repository includes:
  • Model weights (best.pt)
  • Model card with description and details
  • Usage examples and documentation
  • Version history and updates

Downloading the Model

Option 1: Direct Download

Download the model weights directly from HuggingFace:
1
2

Find Model Files

Click on the “Files and versions” tab to view available model files.
3

Download

Download the best.pt file (or latest version) to your local machine.
4

Save to Project

Place the downloaded file in your project directory (e.g., Modelos/best.pt).

Option 2: Using HuggingFace Hub

Use the HuggingFace Hub Python library for programmatic access:
pip install huggingface-hub
Then download the model in your Python code:
from huggingface_hub import hf_hub_download

# Download the model file
model_path = hf_hub_download(
    repo_id="AprendeIngenia/recyclingAI",
    filename="best.pt",
    cache_dir="./models"
)

print(f"Model downloaded to: {model_path}")

Option 3: Git Clone

Clone the entire repository using Git LFS:
# Install Git LFS if not already installed
git lfs install

# Clone the repository
git clone https://huggingface.co/AprendeIngenia/recyclingAI

cd recyclingAI
The model file may be large. Ensure you have sufficient disk space and a stable internet connection.

Using the Model

Basic Usage

Once downloaded, use the model with Ultralytics YOLO:
from ultralytics import YOLO
import cv2

# Load the model
model = YOLO('path/to/best.pt')

# Class names
clsName = ['Metal', 'Glass', 'Plastic', 'Carton', 'Medical']

# Run inference on an image
image = cv2.imread('waste_image.jpg')
results = model(image, stream=True, verbose=False)

# Process results
for res in results:
    boxes = res.boxes
    for box in boxes:
        # Get class and confidence
        cls = int(box.cls[0])
        conf = float(box.conf[0])
        
        print(f"Detected: {clsName[cls]} with {conf*100:.1f}% confidence")

Video Stream Processing

For real-time video processing:
import cv2
from ultralytics import YOLO
import math

# Load model
model = YOLO('Modelos/best.pt')
clsName = ['Metal', 'Glass', 'Plastic', 'Carton', 'Medical']

# Open video capture
cap = cv2.VideoCapture(0)
cap.set(3, 1280)  # Width
cap.set(4, 720)   # Height

while True:
    ret, frame = cap.read()
    if not ret:
        break
    
    # Run inference
    results = model(frame, stream=True, verbose=False)
    
    for res in results:
        boxes = res.boxes
        for box in boxes:
            # Extract detection info
            x1, y1, x2, y2 = box.xyxy[0]
            x1, y1, x2, y2 = int(x1), int(y1), int(x2), int(y2)
            
            cls = int(box.cls[0])
            conf = math.ceil(box.conf[0])
            
            # Draw bounding box
            cv2.rectangle(frame, (x1, y1), (x2, y2), (0, 255, 0), 2)
            cv2.putText(frame, f'{clsName[cls]} {int(conf*100)}%',
                       (x1, y1-10), cv2.FONT_HERSHEY_SIMPLEX,
                       0.5, (0, 255, 0), 2)
    
    cv2.imshow('Waste Detection', frame)
    
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

cap.release()
cv2.destroyAllWindows()

Model Information

Model Specifications

Architecture

YOLOv8 from Ultralytics

Classes

5 waste categories

Format

PyTorch (.pt)

Task

Object Detection

Detection Classes

The model detects these waste categories:
Class IDNameDescription
0MetalMetal cans, containers, and metallic waste
1GlassGlass bottles, jars, and glass materials
2PlasticPlastic bottles, containers, and packaging
3CartonCardboard boxes and paper cartons
4MedicalMedical waste and healthcare items

Requirements

Python Dependencies

Ensure you have the required packages installed:
pip install ultralytics opencv-python numpy
ultralytics>=8.0.0
opencv-python>=4.5.0
numpy>=1.21.0
torch>=1.9.0
pillow>=8.0.0

System Requirements

  • Python: 3.8 or higher
  • RAM: Minimum 4GB (8GB+ recommended)
  • GPU: Optional but recommended for faster inference
  • Disk Space: ~100MB for model weights

Performance Tips

GPU Acceleration

For faster inference, use a CUDA-compatible GPU:
from ultralytics import YOLO

# Load model on GPU
model = YOLO('best.pt')
model.to('cuda')  # Move model to GPU

# Verify GPU usage
import torch
print(f"Using GPU: {torch.cuda.is_available()}")

Batch Processing

Process multiple images efficiently:
images = ['img1.jpg', 'img2.jpg', 'img3.jpg']

# Batch inference
results = model(images, stream=True)

for result in results:
    # Process each result
    result.save()  # Save annotated image

Licensing and Attribution

Please review the model’s license on HuggingFace before using it in commercial applications.

Attribution

When using this model, please provide appropriate attribution:
Model: Reciclaje AI by AprendeIngenia
Source: https://huggingface.co/AprendeIngenia/recyclingAI

Support and Community

For questions, issues, or contributions:
  • HuggingFace Discussions: Use the discussions tab on the model page
  • GitHub: Check the source repository for code and issues
  • YouTube: AprendeIngenia Channel for tutorials

Next Steps

Quick Start

Get started with Reciclaje AI

Model Overview

Learn about model architecture

Limitations

Understand model limitations

Training Data

Learn about the training dataset

Build docs developers (and LLMs) love