Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ollm/opencomic-ai-training/llms.txt
Use this file to discover all available pages before exploring further.
fix-images.mjs is a standalone validation utility for inspecting the consistency of a generated paired dataset. After a generation run — especially one that was interrupted and resumed — it is possible for the clean/ and degraded/ folders to fall out of sync: a file may exist in one folder but not the other, or the pixel dimensions of a clean image may not match the expected scaled dimensions of its degraded counterpart. This script scans both halves of the dataset, identifies every such mismatch, and can either report the problems or permanently delete the offending file pairs.
Invocation
Flags
The name of the dataset folder to validate. The script resolves the full path as
./datasets/<name>/ relative to the repository root. Both a clean/ and a degraded/ subdirectory are expected to exist inside that folder.The integer scale factor used to verify dimension relationships. For a given file, the script checks that
clean.width === degraded.width × scale and clean.height === degraded.height × scale. If this flag is omitted, the scale is auto-detected from the dataset name (see tip below). If no numeric scale can be detected from the name, or if the detected value is NaN, the value defaults to 1.Print the filename and dimensions of each dimension-mismatched file pair to stdout without taking any action. Note that unpaired files (where one side is missing entirely) are counted in the mismatch total but are not individually printed. Use this flag first to review dimension mismatches before running with
--delete.Delete both the
clean/ and degraded/ copies of every mismatched file. If only one side of a pair exists, that single file is deleted. The deletion is performed with fs.unlinkSync and cannot be undone.What constitutes a mismatch
The script considers a file to be mismatched under either of the following conditions:-
Unpaired file — The filename exists in
clean/but not indegraded/, or vice versa. This can happen when a generation run is interrupted mid-image. -
Dimension mismatch — Both files exist, but the clean image dimensions do not equal the degraded image dimensions multiplied by the scale factor:
This guards against partially-written images or files from a different generation run being mixed into the dataset folder.
Output format
When the script runs, it first prints a configuration summary, then (if--print is set) each individual dimension mismatch, and finally a totals line:
--delete is active instead, each deleted filename is logged as it is removed: