Load and validate image
(self, img_path)
| 26 | return os.path.join(base_path, relative_path) |
| 27 | |
| 28 | def load_image(self, img_path): |
| 29 | """Load and validate image""" |
| 30 | img = cv2.imread(img_path) |
| 31 | if img is None: |
| 32 | raise ValueError(f"Failed to load image from {img_path}") |
| 33 | return img |
| 34 | |
| 35 | def preprocess_image(self, img, target_size=(224, 224)): |
| 36 | """Enhanced preprocessing pipeline""" |