-
Notifications
You must be signed in to change notification settings - Fork 267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I want to train with my own dataset #64
Comments
but i don't have labels |
thanks a lot! i'm new to this, i'll ask you again if i got any more problems. thanks again~ |
dear author,
# Mine the topk nearest neighbors (Validation)
# These will be used for validation.
'''
topk = 5
print(colored('Mine the nearest neighbors (Val)(Top-%d)' %(topk), 'blue'))
fill_memory_bank(val_dataloader, model, memory_bank_val)
print('Mine the neighbors')
indices, acc = memory_bank_val.mine_nearest_neighbors(topk)
print('Accuracy of top-%d nearest neighbors on val set is %.2f' %(topk, 100*acc))
np.save(p['topk_neighbors_val_path'], indices)
''' then there will be no # Evaluate
print('Make prediction on validation set ...')
predictions = get_predictions(p, val_dataloader, model)
print('Evaluate based on SCAN loss ...')
scan_stats = scan_evaluate(predictions)
print(scan_stats)
lowest_loss_head = scan_stats['lowest_loss_head']
lowest_loss = scan_stats['lowest_loss']
if lowest_loss < best_loss:
print('New lowest loss on validation set: %.4f -> %.4f' %(best_loss, lowest_loss))
print('Lowest loss head is %d' %(lowest_loss_head))
best_loss = lowest_loss
best_loss_head = lowest_loss_head
torch.save({'model': model.module.state_dict(), 'head': best_loss_head}, p['scan_model'])
else:
print('No new lowest loss on validation set: %.4f -> %.4f' %(best_loss, lowest_loss))
print('Lowest loss head is %d' %(best_loss_head))
print('Evaluate with hungarian matching algorithm ...')
clustering_stats = hungarian_evaluate(lowest_loss_head, predictions, compute_confusion_matrix=False)
print(clustering_stats) there is expecting your response~(sorry to have so many questions) |
Hi @scarletteshu, Yes, you will have to modify the code. |
thanks for your reply, |
Hi @scarletteshu, Hard to say what the problem is exactly. Especially since I don't know the dataset. However, lowering the weight in the loss will likely help. |
If there are still issues let me know. Closing this for now. |
its image datset without labels, should i create it like imagenet-style datasets? i mean images of different labels in different folders
The text was updated successfully, but these errors were encountered: