gathierry / FastFlow

Apache License 2.0
124 stars 22 forks source link

ValueError: continuous format is not supported #6

Closed yilanwanglu closed 2 years ago

yilanwanglu commented 2 years ago

i used 'python main.py -cfg configs/resnet18.yaml --data dataset/mvtec-ad -cat bottle' for training. this error appeared: Traceback (most recent call last): File "main.py", line 201, in train(args) File "main.py", line 148, in train eval_once(test_dataloader, model) File "main.py", line 125, in eval_once auroc = auroc_metric.compute() File "D:\Anaconda3\envs\pt111_g\lib\site-packages\ignite\metrics\epoch_metric.py", line 152, in compute result = self.compute_fn(_prediction_tensor, _target_tensor) File "D:\Anaconda3\envs\pt111_g\lib\site-packages\ignite\contrib\metrics\roc_auc.py", line 13, in roc_auc_compute_fn return roc_auc_score(y_true, y_pred) File "D:\Anaconda3\envs\pt111_g\lib\site-packages\sklearn\metrics_ranking.py", line 580, in roc_auc_score sample_weight=sample_weight, File "D:\Anaconda3\envs\pt111_g\lib\site-packages\sklearn\metrics_base.py", line 72, in _average_binary_score raise ValueError("{0} format is not supported".format(y_type)) ValueError: continuous format is not supported I have no idea what causes the issue,please give me some advice,thanks!

gathierry commented 2 years ago

Did you change the code, since the line number does not match the main.py in this repo. And I guess google can give a better answer for this error ValueError: continuous format is not supported It's usually caused by dtype

cytotoxicity8 commented 2 years ago

I had the problem, too. The problem might be the version of your packages, especially ignite and sci-kit learn. If you follow the requirements.txt, the problem will be solved. However if you don't want to downgrade the version, try to modify the code like this.

In eval_once function of main.py, Before: targets = targets.flatten() After: targets = targets.flatten().type(torch.int32)

Hope you solve your problem!

yilanwanglu commented 2 years ago

Did you change the code, since the line number does not match the main.py in this repo. And I guess google can give a better answer for this error ValueError: continuous format is not supported It's usually caused by dtype

I didn't change the code. I can run it after I modify it according to the instructions of cytotoxicity8. It may be the problem caused by my version. Thanks for your reply!

yilanwanglu commented 2 years ago

I had the problem, too. The problem might be the version of your packages, especially ignite and sci-kit learn. If you follow the requirements.txt, the problem will be solved. However if you don't want to downgrade the version, try to modify the code like this.

In eval_once function of main.py, Before: targets = targets.flatten() After: targets = targets.flatten().type(torch.int32)

Hope you solve your problem!

The problem is solved, thanks a lot!

jiangfeizi commented 4 weeks ago

I think the problem is the InterpolationMode of test dataset。Am i right? image