qqwweee / keras-yolo3

A Keras implementation of YOLOv3 (Tensorflow backend)
MIT License
7.14k stars 3.44k forks source link

How to train model with whole image ? #504

Open ZooZoo-tc opened 5 years ago

ZooZoo-tc commented 5 years ago

I have 32x32 size images. i want train yolo with whole image for object localization.. Need help on approaches... Please help me I am stuck... now

I have tried to train yolo but it is not working it's predicting as all objects as same class

sirius0503 commented 5 years ago

Did you change the classes_names.txt file in model_data? And which classes are you using.

ZooZoo-tc commented 5 years ago

I have only one class. I have changed in classes.txt

sirius0503 commented 5 years ago

@satish4github : I am guessing that when you are using yolo_video.py file for prediction on images/videos, you are getting predictions for other objects, with the class label as that single class. You need to add code like below in yolo.py:

  ```
  if predicted_class != 'person':
          """
          Remember deletion of the box means deletion in box means deletion
          in boxes and scores arrays.
          """

          boxes = np.delete(boxes, i, axis = 0)
          scores = np.delete(scores, i, axis=0)
          continue


Because, if any other classes are detected you need to discard them.

Also, change the default values, of model, classes in yolo.py, before running prediction. The above shouldn't be needed if you change the default values in yolo.py, at the beginning of the class
ZooZoo-tc commented 5 years ago

@satish4github : I am guessing that when you are using yolo_video.py file for prediction on images/videos, you are getting predictions for other objects, with the class label as that single class. You need to add code like below in yolo.py:

if predicted_class != 'person': """ Remember deletion of the box means deletion in box means deletion in boxes and scores arrays. """

      boxes = np.delete(boxes, i, axis = 0)
      scores = np.delete(scores, i, axis=0)
      continue

Because, if any other classes are detected you need to discard them.

Also, change the default values, of model, classes in yolo.py, before running prediction. The above shouldn't be needed if you change the default values in yolo.py, at the beginning of the class

@sirius0503 Sorry for late reply... I have trained model with data set (like Cifar 10) which is having 32x32 image size. I have trained for only 1 class. I have treated whole image a bounding box while training..... Once training is completed then trying to prediction part... basically if you pass any image (even which is not there in data set itself) it says class name with 100% accuracy....

My doubt is can classification data set for object localization/bounding boxes data to train model? I hope you have got my problem...