MVTec-Anomaly-Detection
MVTec-Anomaly-Detection copied to clipboard
'ZeroDivisionError: division by zero'
Hi,
I downloaded the MVTec dataset and am trying to launch the training using carpet images.
However, when I try to run the train.py script python3 train.py -d mvtec/carpet/ -a mvtecCAE -b 2 -l ssim -c grayscale,
it returns me the reported error:
Found 0 images belonging to 2 classes. Found 0 images belonging to 2 classes. INFO:autoencoder.autoencoder:initiating learning rate finder to determine best learning rate. simulating training for different learning rates... this may take a few moments... Traceback (most recent call last): File "train.py", line 238, in <module> main(args) File "train.py", line 81, in main autoencoder.find_lr_opt(train_generator, validation_generator) File "/home/thomas/MVTec-Anomaly-Detection/autoencoder/autoencoder.py", line 191, in find_lr_opt restore_weights_only=True, File "/root/anaconda3/envs/mvtec/lib/python3.6/site-packages/ktrain/core.py", line 553, in lr_find verbose=verbose) File "/root/anaconda3/envs/mvtec/lib/python3.6/site-packages/ktrain/lroptimize/lrfinder.py", line 94, in find self.lr_mult = (end_lr / start_lr) ** (1 / num_batches) ZeroDivisionError: division by zero
How can I fix it?
same error, did you find the solution?
Hey guys. I faced the same issue and I just came up with the solution. The only thing you gotta do is following the instructions from the readme file regarding to the project structure. This 'ZeroDivisionError: division by zero' error happens because the script is not finding any train/ folder inside your mvtec/carpet/ path. Create a folder inside carpet/ and call it "train". Just that. The script will automatically load the images from the train/ folder.
I hope it helps.