This is the model for https://github.com/hasu234/SDPDSSample. this repository.

This classifier can classify between dog, berry, flower and bird images. Sample Dataset

Dependencies

Setting up conda Environment

git clone https://github.com/hasu234/SDPDSSample.git
cd SDPDSSample
conda create -n myenv python=3.9
conda activate myenv
pip install -r requirmen.txt
conda env create -f environment.yml

Trining your data

├── dataset
|   ├── train
│   │   ├── class1
│   │   │   ├──image1.jpg
│   │   │   ├──image2.jpg
│   │   ├── class2
│   │   │   ├──image1.jpg
│   │   │   ├──image2.jpg
│   │   ├── class3
│   │   │   ├──image1.jpg
│   │   │   ├──image2.jpg
│   │   ├── class4
│   │   │   ├──image1.jpg
│   │   │   ├──image2.jpg
|   ├── test
│   │   ├── class1
│   │   │   ├──image1.jpg
│   │   │   ├──image2.jpg
│   │   ├── class2
│   │   │   ├──image1.jpg
│   │   │   ├──image2.jpg
│   │   ├── class3
│   │   │   ├──image1.jpg
│   │   │   ├──image2.jpg
│   │   ├── class4
│   │   │   ├──image1.jpg
│   │   │   ├──image2.jpg

or make some chainges on train.py according to to your dataset directory.

python train.py /path/to/dataset_directory

Running inference

python infer.py path/to/image.jpg path/to/model.pth

Running on Docker

git clone https://github.com/hasu234/SDPDSSample.git
cd SDPDSSample

Before Building the docker image transfer the files (model, test image, dataset) to current working directory if you don't want to deal with docker volume

docker build -t sdpdsample .
docker run -d sdpdsample

if the container failed to run in background, run it on foreground using docker run -it sdpdsample then exit to get the running container id

docker ps
docker exec -it <container id> bash

You will get a Linux like command-line interface

# for training your data
python train.py /path/to/dataset_directory

# for running inference
python infer.py path/to/image.jpg path/to/model.pth