Closed junyuancat1 closed 2 years ago
@junyuancat1 this is simply classification. Classification models can be trained for multi-positive labels, i.e. person and woman at the same time.
@junyuancat1 this is simply classification. Classification models can be trained for multi-positive labels, i.e. person and woman at the same time.
but the test softmax outputs as results which means the sum of the results is 1
@junyuancat1 sure, but softmax is optional, you can remove this for multi-class.
@sir, how to create dataset for classifier... is it enough to have put each class in respective folder....(dog images in folder name "dog", similarly for cat....)....if so how to train then, i mean how to give and where to give path name...
@PraveenMNaik see classifier.py to train a classifier:
@glenn-jocher Hi, I have a similar question, as I have a detection problem in which I want to use multi-positive labels too. i.e. I have some classes as [dog, cat, male, female] and I want the system to find a male dog in the picture showing "dog, male". Is that possible? If so, could you give me some hint about where to modify the code? Thanks in advance.
@mm0806son multilabel classification is the default for YOLOv5 model classification architectures, but it’s true the dataset format is fixed traditionally with directories
@junyuancat1 sure, but softmax is optional, you can remove this for multi-class.
yeah,excuse me for lacking this knowledges. I still wanna ask what does the output meaning~ for example a double classifier as [cat,dog], and one pic infered shows the out put as [3, 5] what does the number 3 and 5 really mean and normally we use softmax for changing 3,5 to probabilities which add up to 1.0 By what kind of func can i change 3,5 to two probablilities and it shows independent probability of it own class, no related with other classes. Thanks for reply!
@junyuancat1 you can use a sigmoid function to bound inputs to within a 0-1 range. These do not represent probabilities in a statistical sense, but they are typically treated as such by the ML community.
@junyuancat1 you can use a sigmoid function to bound inputs to within a 0-1 range. These do not represent probabilities in a statistical sense, but they are typically treated as such by the ML community.
yeah! I understand! for [dog,cat] problem as classifier branch designed, if i put an image[catdog] in folder cat, it means the input = [0,1] and if i put this image in folder dog, it means the input = [1,0], which is not correct. I may change the ImageFolder function to change the input label as a single [1,1] and I may use BCE as loss func instead of entropyloss because the entropy contains softmax, and it will influence the outputs to addup = 1.
@junyuancat1 Hi, I think I'm currently working on the same issue as you. I did some searches and what I got is here.
I found this PR #5593 and this issue mentioned in discussion #7673 . This PR is for solving the multilabel training and detection if I well understood. This PR is not merged and I go to its branch to merge it by myself. It seems good though I'm still preparing my dataset and didn't test yet..
For the dataset, for example I have [dog, cat, male, female] as class. I put all images in one folder and in each txt I put [class bbox; class same_bbox]. So it's
0 0.59905 0.45125 0.04009 0.07083
2 0.59905 0.45125 0.04009 0.07083
for a "dog male".
I also noticed that there is a discussion about the wrong penalty on multi-label in the loss function. But I can't remember where I saw it.
I hope this can help you a little. Do let me know if you have any progress :)
👋 Hello, this issue has been automatically marked as stale because it has not had recent activity. Please note it will be closed if no further activity occurs.
Access additional YOLOv5 🚀 resources:
Access additional Ultralytics ⚡ resources:
Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed!
Thank you for your contributions to YOLOv5 🚀 and Vision AI ⭐!
Search before asking
Description
hi there I am wondering wheather coule I use the branch classifer like a detector? For example as now branch classifier, if we have multi classes [dog, cat, cow], tensor infer output scores[dog]+score[cat]+score[cow] = 1 In this case, if I labeled a picture as a cat,model will learn cat score 1, dog score 0, cow score 0. which's a classic classifer thing.
But I don't want labels to influence each other when training, like what detector do. which means if I labeled a pic as a cat, model will learn that cat score 1, but do not learn dog 0 cow 0. If I got an image of catdog (LOL), I put this pic in both cat dir and dog dir(as label cat score 1, dog score 1) , And when I infering such a creature, I wanna both cats and dogs score high. maybe like score[dog,cat,cow] = [0.83, 0.92, 0.1].
So I hope to get help from you on how to quickly implement such a model by finetune classifer branch. thanks!
Use case
No response
Additional
No response
Are you willing to submit a PR?