Koti05/Cat-Dog-Pandas
0
๐พ Cat-Dog-Pandas Classifier
A Streamlit web app that uses PyTorch and transfer learning (AlexNet) to classify images of Cats ๐ฑ, Dogs ๐ถ, and Pandas ๐ผ in real time. Deployed using Docker on Hugging Face Spaces.
๐ง Model Overview
- Base Model: AlexNet (Transfer Learning)
- Fine-tuned Layers: Layer4 + Fully Connected layers
- Custom Classifier:
- Linear(2048 โ 512) + ReLU + Dropout(0.7)
- Linear(512 โ 128) + ReLU + Dropout(0.3)
- Linear(128 โ 3) [Output Layer]
- Classes: Cat, Dog, Panda
- Auto-Download: Model (
model.pth) fetched automatically from Hugging Face - Device Support: CPU/GPU auto-detection
๐ Performance Summary
๐ Project Structure
Cat-Dog-Pandas/ โโโ ๐ณ Dockerfile โโโ ๐ฑ app.py โโโ ๐ metrics.json โโโ ๐ง model.pth โโโ ๐ Project.ipynb โโโ ๐ requirements.txt โโโ ๐ผ๏ธ confusion_matrix.png โโโ ๐ง datasplit.py
โ๏ธ Dockerfile (Used in this Project)
FROM python:3.9-slim
WORKDIR /app
RUN apt-get update && apt-get install -y \
build-essential \
curl \
git \
&& rm -rf /var/lib/apt/lists/*
COPY requirements.txt .
RUN pip3 install --no-cache-dir -r requirements.txt
COPY . .
RUN useradd -m -u 1000 user && \
chown -R user:user /app
USER user
EXPOSE 7860
HEALTHCHECK CMD curl --fail http://localhost:7860/_stcore/health
CMD ["streamlit","run","app.py","--server.port=7860","--server.address=0.0.0.0","--server.enableXsrfProtection=false","--server.enableCORS=false","--server.maxUploadSize=50"]
---