Skip to content

hafidh561/Garbage-Image-Classification

Repository files navigation

Garbage Image Classification

Description

Garbage image classification using PyTorch transfer learning pretrained model Resnet152 with FastAPI for API based application. This model will classification 6 class: cardboard, glass, metal, paper, plastic, trash (other).

Installation

$ git clone https://github.com/hafidh561/Garbage-Image-Classification.git

Installation Python

# Python version 3.6
$ git clone https://github.com/nodefluxio/vortex.git
$ cd vortex/ && git checkout drop-enforce
$ pip install ./src/runtime[onnxruntime] && cd ../
$ pip install -r requirements.txt
$ python download_model.py

Installation Docker

# Newest docker version
$ docker build -t hafidh561/garbage-image-classification:1.0 .

Usage

Usage Python

$ python app.py

Usage Docker

$ docker run --rm -p <YOUR PORT>:6969 hafidh561/garbage-image-classification:1.0
# Example
$ docker run --rm -p 301:6969 hafidh561/garbage-image-classification:1.0

Usage API

  1. After you run app use python or docker, open your web browser and go to http://localhost:<YOUR PORT | 6969>/docs for looking some documentation.

  2. Now it's time to testing API, open your application for testing API. I'll use Postman for testing API.

  3. Set up postman like this.

    postman_body

  4. Press button "Select Files" to select image you want to classification.

  5. Press "Send" button and waiting for response.

  6. Now open response body and look object response member class and search for highest value.

Example Test API

glass

{
	"filename": "glass.jpg",
	"contentype": "image/jpeg",
	"class": "glass",
	"confidence": "0.99995697"
}

Report Article

Give It a Try

If you want make your own deep learning for image classification? Give it a try in this Google Colab

License

MIT LICENSE

© Developed by hafidh561 - Internship at Nodeflux

About

Garbage image classification using PyTorch transfer learning pretrained model Resnet152 with FastAPI for API based application.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages