Coder Social home page Coder Social logo

clothing-detection's Introduction

Clothing detection using YOLOv3, RetinaNet, Faster RCNN in ModaNet and DeepFashion2 datasets.

Datasets

Models

Weights

All weights and config files are in https://drive.google.com/drive/folders/1jXZZc5pp2OJCtmQYelzDgPzyuraAdxXP?usp=sharing

Using

  • Use new_image_demo.py , and choose dataset, and model.
  • Use YOLOv3Predictor class for YOLOv3 and Predictor class for Faster and RetinaNet and Mask.

Coming soon

  • Update use of retrieval.

clothing-detection's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

clothing-detection's Issues

AUC metrics on test set

What AUC scores did you get on your test set for YOLOV3 MODANET, and what test set did you use? I'm trying to replicate your training and testing.

Annotation of the dataset

Hi, just wondering how did you train your yolov3 model to for the classification? did you convert the json files to txt files for training?

Cannot find yolov3-modanet_last.weights

Getting the error

Traceback (most recent call last):
  File "new_image_demo.py", line 62, in <module>
    detectron = YOLOv3Predictor(params=yolo_params)
  File "/home/ubuntu/server/Clothing-Detection/predictors/YOLOv3.py", line 22, in __init__
    self.model = self.load_model()
  File "/home/ubuntu/server/Clothing-Detection/predictors/YOLOv3.py", line 59, in load_model
    model.load_darknet_weights(self.params['weights_path'])
  File "/home/ubuntu/server/Clothing-Detection/yolo/utils/models.py", line 312, in load_darknet_weights
    with open(weights_path, "rb") as f:
FileNotFoundError: [Errno 2] No such file or directory: 'yolo/weights/yolov3-modanet_last.weights'

it seems like download_weights.sh doesn't include the yolov3-modanet_last.weights file any ideas ?

Is there any way to use segmentation?

Hi,

Is there any segmentation model in this repo? I couldn't find out it.
Or, is it possible to adapt this application to the segmentation problem?

Thank you!

can not load model

size mismatch for roi_heads.box.predictor.cls_score.weight: copying a param with shape torch.Size([14, 1024]) from checkpoint, the shape in current model is torch.Size([81, 1024]).
size mismatch for roi_heads.box.predictor.cls_score.bias: copying a param with shape torch.Size([14]) from checkpoint, the shape in current model is torch.Size([81]).
size mismatch for roi_heads.box.predictor.bbox_pred.weight: copying a param with shape torch.Size([56, 1024]) from checkpoint, the shape in current model is torch.Size([324, 1024]).
size mismatch for roi_heads.box.predictor.bbox_pred.bias: copying a param with shape torch.Size([56]) from checkpoint, the shape in current model is torch.Size([324]).

Cannot detect anything with the provided weights and model

Hey there, I want to say sorry beforehand that I ask this (possibly) stupid question, but I am new to object detection and all it's nooks and crevices. I wanted to ask you if you could help me with this problem? I have modified the webcam_demo.py file so that it loads the yolov3-modanet.cfg model, the modanet.names classes, and yolov3.weights weights. I have followed the tutorial in this video: https://www.youtube.com/watch?v=yWwzFnAnrLM&ab_channel=AlSangam but to no avail, perhaps the weight file is different?

Here's my modified code inside the webcam_demo.py file.

from __future__ import division

from yolo.utils.models import *
from yolo.utils.utils import *
from yolo.utils.datasets import *
from predictors.YOLOv3 import YOLOv3Predictor

import torch
from torch.utils.data import DataLoader
from torchvision import datasets
from torch.autograd import Variable

import matplotlib.pyplot as plt
import cv2

from yolo.utils.utils2 import load_model, cv_img_to_tensor

device = torch.device("cuda" if torch.cuda.is_available() else "cpu")

# params = \
# {
#   "model_def" : "yolo/df2cfg/yolov3-df2.cfg",
#   "weights_path" : "yolo/weights/yolov3.weights",
#   "class_path":"yolo/df2cfg/df2.names",
#   "conf_thres" : 0.25,
#   "nms_thres" :0.4,
#   "img_size" : 416,
#   "device" : device
# }

params = \
{
  "model_def" : "yolo/modanetcfg/yolov3-modanet.cfg",
  "weights_path" : "yolo/weights/yolov3.weights",
  "class_path":"yolo/modanetcfg/modanet.names",
  "conf_thres" : 0.25,
  "nms_thres" :0.4,
  "img_size" : 416,
  "device" : device
}


classes = load_classes(params['class_path'])
Tensor = torch.cuda.FloatTensor if torch.cuda.is_available() else torch.FloatTensor
cmap = plt.get_cmap("tab20b")
colors = np.array([cmap(i) for i in np.linspace(0, 1, 20)])
np.random.shuffle(colors)

yolov3 = YOLOv3Predictor(params=params)
model = yolov3.load_model()

cap = cv2.VideoCapture(0)

while(True):
  # img = cv2.imread('tests/amazon.jpg')
  _, frame = cap.read()
  img = frame.copy()
  x , _,_ = cv_img_to_tensor(img)
  x.to(device)   
  
  # Get detections
  with torch.no_grad():
    input_img = Variable(x.type(Tensor))  
    detections = model(input_img)
    detections = non_max_suppression(detections, params['conf_thres'], params['nms_thres'])
  
  if detections[0] is not None:
    # Rescale boxes to original image
    detections = rescale_boxes(detections[0], params['img_size'], img.shape[:2])
    unique_labels = detections[:, -1].cpu().unique()
    n_cls_preds = len(unique_labels)
    # bbox_colors = random.sample(colors, n_cls_preds , seed)
    bbox_colors = colors[:n_cls_preds]

    for x1, y1, x2, y2, conf, cls_conf, cls_pred in detections:
      print("\t+ Label: %s, Conf: %.5f" % (classes[int(cls_pred)], cls_conf.item()))
      x1, y1, x2, y2 = int(x1), int(y1), int(x2), int(y2)

      color = bbox_colors[int(np.where(unique_labels == int(cls_pred))[0])]
      color = tuple(c*255 for c in color)
      color = (color[2],color[1],color[0])
      cv2.rectangle(frame, (x1,y1), (x2,y2), color=color, thickness=3)
      # cv2.rectangle(img, (x1,y1), (x2,y2), color=color, thickness=3)
      # print(int(cls_pred))
      font = cv2.FONT_HERSHEY_SIMPLEX
      text =  "%s conf: %.3f" % (classes[int(cls_pred)] ,cls_conf.item())
      cv2.rectangle(frame,(x1-2,y1-25), (int(x1 + 8.5*len(text)),y1) , color=color, thickness=-1)
      cv2.putText(frame,text,(x1,y1-5), font, 0.5, color=(255,255,255), thickness=1, lineType=cv2.LINE_AA)
      # cv2.rectangle(img,(x1-2,y1-25), (int(x1 + 8.5*len(text)),y1) , color=color, thickness=-1)
      # cv2.putText(img,text,(x1,y1-5), font, 0.5, color=(255,255,255), thickness=1, lineType=cv2.LINE_AA)
            
  cv2.imshow('Detections',frame)
  # cv2.imshow('Detections',img)
  if cv2.waitKey(30) & 0xFF == ord('q'):
      break

I have tested the model with my webcam and the test images but to no avail, no bounding boxes are created and the model does not seem to detect anything at all! If I change the model to darknet53.conv.74 weights file, there are bounding boxes everywhere! Like so:

image

Can you give me a hint or a solution to this problem, or the thing that might went wrong? Thank you so much! I need this for my personal research :( A timely response will be appreciated. This GitHub Issue is my last hope in finishing my research on time...

Thank you so much beforehand, for your possible help and this very helpful repository! ๐Ÿš€

cannot import name '_C' from 'maskrcnn_benchmark'

Hello,
I am new to this ML thing
i have done setup for maskrcnn_benchmark i dont have GPU.
all the time i am getting "ImportError: cannot import name '_C' from 'maskrcnn_benchmark'" error
Please Help

error loading state_dict

the model architecture in config file and the weight file seems to have different shape.
I am getting this error:
size mismatch for roi_heads.box.predictor.cls_score.weight: copying a param with shape torch.Size([14, 1024]) from checkpoint, the shape in current model is torch.Size([81, 1024]).
size mismatch for roi_heads.box.predictor.cls_score.bias: copying a param with shape torch.Size([14]) from checkpoint, the shape in current model is torch.Size([81]).
size mismatch for roi_heads.box.predictor.bbox_pred.weight: copying a param with shape torch.Size([56, 1024]) from checkpoint, the shape in current model is torch.Size([324, 1024]).
size mismatch for roi_heads.box.predictor.bbox_pred.bias: copying a param with shape torch.Size([56]) from checkpoint, the shape in current model is torch.Size([324]).

Dataset link

Can you please share the link for ModaNet dataset download

does not detect well

Hello,

I downloaded your code and tried to run it on an image from the web but it does not work. It gives me thousands of bounding boxes. Are you sure from your training on DeepFashion2? and are you sure of your non maximum suppression function because i found others on the web but still no results.

Thanks in advance

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.