vicoslab / mixed-segdec-net-comind2021

Official PyTorch implementation for "Mixed supervision for surface-defect detection: from weakly to fully supervised learning"
Other
292 stars 89 forks source link

How to change the binary classification to multi-classification? #34

Open wang-gang opened 2 years ago

wang-gang commented 2 years ago

KSDD datasets are binary classification. If every picture in my datasets is an object with two or more defects, how can I modify the algorithm to be multi-classified?I'd appreciate it if you could help me!Thanks!

skokec commented 2 years ago

In general, for multi-class prediction you will need to change loss BCEWithLogitsLoss to softmax + CrossEntropyLoss, but there will be many minor details need to be updated for this to work (dataset reading expect binary data, target data in correct format, testing and evaluation, etc), which is the reason we did not integrate multi-class support.

wang-gang commented 2 years ago

Hello, thank you very much for your reply,According to what you said, I tried to modify the loss function to CrossEntropyLoss, but the error was reported and the dimension did not match. Another question is how to modify the network output into categories and corresponding scores. In addition, my datasets has two defects on one object. Can I follow the method of STEEL datasets? However, I don't understand the meaning of EncodedPixels in the train.csv file of STEEL datasets. Finally, thank you again. If you have time, please help me to answer these three questions. 从 Windows 版邮件发送

发件人: Domen Tabernik 发送时间: 2022年10月26日 0:13 收件人: vicoslab/mixed-segdec-net-comind2021 抄送: wang-gang; Author 主题: Re: [vicoslab/mixed-segdec-net-comind2021] How to change the binaryclassification to multi-classification? (Issue #34)

In general, for multi-class prediction you will need to change loss BCEWithLogitsLoss to softmax + CrossEntropyLoss, but there will be many minor details need to be updated for this to work (dataset reading expect binary data, target data in correct format, testing and evaluation, etc), which is the reason we did not integrate multi-class support. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>