Hi guys, I have some csv file with structure
img |class0|class1|class2|class3|class4|class5...
|-----|------|------|------|------|------|------
|path1|0 |0 |1 |0 |0 |1
|path2|0 |1 |1 |0 |1 |0
|path3|0 |0 |0 |1 |0 |0
.................................................
.................................................
|pathn|1 |1 |0 |1 |0 |0
|-----|------|------|------|------|------|------
class mydataset(Dataset):
...
def __getitem__(self,idx):
...
labels=np.array(self.labels.iloc[idx,1:])
return {'img':img,'labels':labels}
I am trying to use
n_classes=df.shape[0]-1
model = EfficientNet.from_pretrained('efficientnet-b1',num_classes=n_classes).to(device)
with
loss = torch.nn.BCELoss()
but it doesn’t work, how to implement in my case multilabel classification?