'Tensorflow preprocessing images loops twice in PyCharm but not Jupyter Notebooks
I am setting a directory path and formatting images using tensorflow's preprocessing. My issue is when I run this is jupyter notebooks it prints out a single output with Files and Classes found. When I run the same thing in PyCharm it loops through the entire main.py twice and then stops.
Here is the code:
import tensorflow as tf
IMG_SIZE = (224, 224)
# Set directory paths
test_dir = "D:/Python/Character_Vision_App/Total_Train_Test_Split/test"
train_dir = "D:/Python/Character_Vision_App/Total_Train_Test_Split/train"
# Format images
train_data = tf.keras.preprocessing.image_dataset_from_directory(train_dir,
label_mode="categorical",
image_size=IMG_SIZE)
test_data = tf.keras.preprocessing.image_dataset_from_directory(test_dir,
label_mode="categorical",
image_size=IMG_SIZE,
shuffle=False)
Output in Jupyter Notebook:
Found 317 files belonging to 24 classes.
Found 1308 files belonging to 24 classes.
Output in Pycharm:
Found 317 files belonging to 24 classes.
Found 1308 files belonging to 24 classes.
Found 317 files belonging to 24 classes.
Found 1308 files belonging to 24 classes.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
