Skip to content
This repository has been archived by the owner on Jan 12, 2024. It is now read-only.

I tried you code in mnist dataset, but I got NaN error #34

Closed
DeepBlurt opened this issue Jun 1, 2019 · 8 comments
Closed

I tried you code in mnist dataset, but I got NaN error #34

DeepBlurt opened this issue Jun 1, 2019 · 8 comments

Comments

@DeepBlurt
Copy link

No description provided.

@DeepBlurt
Copy link
Author

DeepBlurt commented Jun 1, 2019

Traceback (most recent call last):
File "train.py", line 43, in
model.train()
File "/home/ax/Anomaly/GANomaly/lib/model.py", line 280, in train
res = self.test()
File "/home/ax/Anomaly/GANomaly/lib/model.py", line 354, in test
auc = evaluate(self.gt_labels, self.an_scores, metric=self.opt.metric)
File "/home/ax/Anomaly/GANomaly/lib/evaluate.py", line 24, in evaluate
return roc(labels, scores)
File "/home/ax/Anomaly/GANomaly/lib/evaluate.py", line 49, in roc
fpr, tpr, _ = roc_curve(labels.numpy(), scores.numpy())
File "/home/ax/anaconda3/lib/python3.6/site-packages/sklearn/metrics/ranking.py", line 622, in roc_curve
y_true, y_score, pos_label=pos_label, sample_weight=sample_weight)
File "/home/ax/anaconda3/lib/python3.6/site-packages/sklearn/metrics/ranking.py", line 402, in _binary_clf_curve
assert_all_finite(y_score)
File "/home/ax/anaconda3/lib/python3.6/site-packages/sklearn/utils/validation.py", line 72, in assert_all_finite
_assert_all_finite(X.data if sp.issparse(X) else X, allow_nan)
File "/home/ax/anaconda3/lib/python3.6/site-packages/sklearn/utils/validation.py", line 56, in _assert_all_finite
raise ValueError(msg_err.format(type_err, X.dtype))
ValueError: Input contains NaN, infinity or a value too large for dtype('float32')

@DeepBlurt
Copy link
Author

DeepBlurt commented Jun 1, 2019

I guess the reason lies in the version of sklearn, or pytorch, But I don't know the exact version you used, waiting for your answer!
-------------------update-------------------
I down grade the version of sklearn, the error evaded, but the AUC result got nan:
Avg Run Time (ms/batch): 8.383 AUC: nan max AUC: 0.000

Could you please point out the reason?

@DeepBlurt DeepBlurt changed the title I tried you code in mnist dataset, but I got the following error: I tried you code in mnist dataset, but I got NaN error Jun 1, 2019
@lzzlxxlsz
Copy link

have you run the code successufully? and how about the result?

@DeepBlurt
Copy link
Author

DeepBlurt commented Jun 11, 2019

have you run the code successufully? and how about the result?

I have run successfully, the result differs from the article, I got following AUC:

0.7897 , 0.4115 , 0.7857 , 0.6432 , 0.6759 , 0.7587, 0.745 , 0.5428 , 0.8484 , 0.5741
in MNIST, does this result make sense? Can you offer your result?

I modified the train step in code, because if not, it does not do any training, thus got NaN error. I make train step equal to ratio of number of samples and batch size per epoch.

@lzzlxxlsz
Copy link

sorry,I don't run this code.and does the result be similar with the test image?

@Funple
Copy link

Funple commented Jun 19, 2019

have you run the code successufully? and how about the result?

I have run successfully, the result differs from the article, I got following AUC:

0.7897 , 0.4115 , 0.7857 , 0.6432 , 0.6759 , 0.7587, 0.745 , 0.5428 , 0.8484 , 0.5741
in MNIST, does this result make sense? Can you offer your result?

I modified the train step in code, because if not, it does not do any training, thus got NaN error. I make train step equal to ratio of number of samples and batch size per epoch.

Could you provide your changed code?

@DeepBlurt
Copy link
Author

I find this code not stable, then I tried this code:
https://github.com/caiya55/ganomaly-tensorflow , you can have a try, this code is much stable and easy to understand.

@Funple
Copy link

Funple commented Jun 20, 2019

Thank you for your effective reply.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants