AlexeyAB / darknet

YOLOv4 / Scaled-YOLOv4 / YOLO - Neural Networks for Object Detection (Windows and Linux version of Darknet )
http://pjreddie.com/darknet/
Other
21.72k stars 7.96k forks source link

Question: Yolo possible for Image-Classification instead of Object-Detection? #6055

Open flowzen1337 opened 4 years ago

flowzen1337 commented 4 years ago

Hi @AlexeyAB

i came across a problem where i used tensorflow for but i want to do it all in YOLO itself without using tensorflow. I want to classify a image for example as "image of cars" instead of detecting each object "car" in the image.

Can i do it also with yolo? (just annotate a bunch of pictures like i do it with objects?)

I thought about cropping the whole picture as object class "image of cars" with it's whole dimension (if image got 1280x720 i would annotate the whol 1280x720 as the "image-classification-object") like in this example:

car_classification

Instead of cropping each object car (for what yolo is meanly supposed to be i guess): car_detection

So my questions are: a) Is it possible with yolo to classify a whole picture? b) Is it possible like explained above this? c) Would you recommend a other way of doing it?

Thanks for your help! Cheers

ravi02512 commented 4 years ago

Hi flowzen1337, Yes it is possible to perform image classification with darknet repo and there is also bunch of networks available for image classification problem.

flowzen1337 commented 4 years ago

Hi flowzen1337, Yes it is possible to perform image classification with darknet repo and there is also bunch of networks available for image classification problem.

Thanks @ravi02512 !

Can you point me in the right direction (any tipps would be helpfull!) if my idea from above is possible with the same training procedure like for object detection, just annotating the whole image instead of the objects in the image?

Which network would you recommend for doing it?

Thanks for your help 💯 🥇 :-)

1027663760 commented 4 years ago

look:https://pjreddie.com/darknet/imagenet/

lizq-git commented 3 years ago

look:https://pjreddie.com/darknet/imagenet/

Hi, 1027, I believed the question is how do train a classifier from via darknet, I am running into the same issue, the website that you have shared doesn't contain the idea of "transfer learning" via the provided .cfg and .weight file

lizq-git commented 3 years ago

Hi, Flowzen.

I am facing this issue as well.

The reason I wanted to have a classifier via darknet is that darknet C++ api is more graceful than TensorFlow.

So, I have tried out what you have described today.

I have 5 classes, I faked the "class xmin xmax ymin ymax' information, e.g. class 1 has 0, imgWidth0.1, 0, imgHeight0.1, then class 2 has 0, imgWidth0.2, 0 imgWidth0.2.

The loss is beautiful, but the result is ugly, as the bounding box is happening everywhere.

So, I went on to the official tutorial https://pjreddie.com/darknet/ - train a classifer on Cifar10, the top 1 accuracy for my dataset is ~60%.

And there are still VGG16.cfg, but when I used it, the loss became inf after 250ish iteration.

I am stilling looking for a solution for this, how about you? Have you solved your problem?