Open Kallamamran opened 3 weeks ago
I recommend looping through all the images and saving them as PNGs. This should help ensure that there are no corrupted files causing the error. Below is a Python code that you can be used to perform this. Code includes error handling to skip any problematic files
import os
from PIL import Image
def convert_images_to_png(image_folder, output_folder):
if not os.path.exists(output_folder):
os.makedirs(output_folder)
for root, _, files in os.walk(image_folder):
for file in files:
try:
# Construct full file path
file_path = os.path.join(root, file)
# Open the image file
with Image.open(file_path) as img:
# Convert the image to RGB mode if not already
img = img.convert("RGB")
# Construct the output file path
output_file_path = os.path.join(output_folder, os.path.splitext(file)[0] + ".png")
# Save the image as a PNG
img.save(output_file_path, "PNG")
print(f"Successfully converted {file} to PNG.")
except Exception as e:
print(f"Error converting {file}: {e}")
continue
image_folder = "path/to/your/images"
output_folder = "path/to/save/pngs"
convert_images_to_png(image_folder, output_folder)
"path/to/your/images"
with the directory where your images are stored."path/to/save/pngs"
with the directory where you want to save the converted PNG files.This approach should help in identifying if the issue is with a particular image or set of images.
check that each and all your caption file txt are encoded in UTF8. The problem lies there. You can use Notepad++ to resave them or convert them.
When running the training the generation stops with this error every time and always with "codec can't decode byte 0xeb in position 604". Running the same training as one that worked. Only difference is these images are not cropped and rescaled, so now it's running bucketing. Also there are 338 images instead of 169.