PConv-Keras icon indicating copy to clipboard operation
PConv-Keras copied to clipboard

ZeroDivisionError: integer division or modulo by zero

Open SunnyPann opened this issue 6 years ago • 3 comments

Thank you for sharing.I try to train on my own training set, but every epoc will report an error, I don't know what the problem is, I hope to get your help. image

image

SunnyPann avatar May 13 '19 13:05 SunnyPann

I have the same problem. Have you found a solution or is this problem still unsolved?

StevenCyb avatar Jun 13 '19 19:06 StevenCyb

Solution.

'ZeroDivisionError' caused by the wrong path shows "Found 0 images belonging to 1 classes. If you do on your own dataset or imagenet dataset, make sure pick out data in the directory. For example code, check notebooks/Step4/ "#Pick out an example codeline" with next(train / val / test_generator).

ghost avatar Jun 17 '19 02:06 ghost

@Parkjh215 is right. Beacuse your validation generator get 0 images. Change the code in main.py:

    # Create validation generator
    val_datagen = AugmentingDataGenerator(rescale=1./255)
    val_generator = val_datagen.flow_from_directory(
        args.validation, 
        MaskGenerator(512, 512, 3), 
        target_size=(512, 512), 
        batch_size=args.batch_size, 
        #classes=['val'],   # problem is here!
        seed=42
    )

Or you can remain the code unchanged, and change the directory name of your validation images to "val".

liminn avatar Jul 09 '19 03:07 liminn