summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cnn_v3/docs/HOW_TO_CNN.md1
-rw-r--r--cnn_v3/training/cnn_v3_utils.py8
2 files changed, 6 insertions, 3 deletions
diff --git a/cnn_v3/docs/HOW_TO_CNN.md b/cnn_v3/docs/HOW_TO_CNN.md
index bb6f7a7..56ee101 100644
--- a/cnn_v3/docs/HOW_TO_CNN.md
+++ b/cnn_v3/docs/HOW_TO_CNN.md
@@ -274,6 +274,7 @@ dataset/
- If `simple/` or `full/` subdir is absent the dataloader scans the root directly
- Minimum viable dataset: 1 sample (smoke test only); practical minimum ~50+ for training
- You can mix Blender and photo samples in the same subdir; the dataloader treats them identically
+- `target.png` may differ in resolution from `albedo.png` — the dataloader resizes it to match albedo automatically (LANCZOS)
---
diff --git a/cnn_v3/training/cnn_v3_utils.py b/cnn_v3/training/cnn_v3_utils.py
index 8da276e..5b43a4d 100644
--- a/cnn_v3/training/cnn_v3_utils.py
+++ b/cnn_v3/training/cnn_v3_utils.py
@@ -273,9 +273,11 @@ class CNNv3Dataset(Dataset):
matid = load_gray(sd / 'matid.png')
shadow = load_gray(sd / 'shadow.png')
transp = load_gray(sd / 'transp.png')
- target = np.asarray(
- Image.open(sd / 'target.png').convert('RGBA'),
- dtype=np.float32) / 255.0
+ h, w = albedo.shape[:2]
+ target_img = Image.open(sd / 'target.png').convert('RGBA')
+ if target_img.size != (w, h):
+ target_img = target_img.resize((w, h), Image.LANCZOS)
+ target = np.asarray(target_img, dtype=np.float32) / 255.0
return albedo, normal, depth, matid, shadow, transp, target
def __getitem__(self, idx):