Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.
/ ClothesDetector Public archive

Microservice detecting clothes on given image

Notifications You must be signed in to change notification settings

pawelbeza/ClothesDetector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Clothes detector

Microservice detecting clothes on given image using:

Download model

Download model from here and place it in models dir. Examplary download using gdown tool:
mkdir models && gdown -O ./models/model.pth --id google_drive_id

Quick note

Model architecture and other details can be found in the following repository https://github.com/pawelbeza/ClothesDetectorModel

Build

docker build -t clothes-detector .

Run container

using CPU

docker run --rm -p 8080:8080 --name clothes-detector clothes-detector

using GPU

docker run --gpus all --rm -p 8080:8080 --name clothes-detector clothes-detector

Quick note

nvidia-container-toolkit package is needed to run container with GPU support

Visualize predictions

import cv2
import requests

from PIL import Image
from detectron2.utils.visualizer import Visualizer
from detectron2.data import detection_utils as utils

URL = "IP:8080/detect"
files = {"image": open(filename, 'rb')}

res = requests.post(url=URL, files=files).json()

img = cv2.imread(filename)
img = utils.convert_image_to_rgb(img, 'BGR')

visualizer = Visualizer(img)
out = visualizer.overlay_instances(
    labels=res['classes'],
    boxes=res['boxes']
)

img_pil = Image.fromarray(out.get_image(), 'RGB')
img_pil.show()

About

Microservice detecting clothes on given image

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published