Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -436,17 +436,10 @@ class ForgeryDetector:
|
|
| 436 |
# Convert tensor back to numpy: (C, H, W) -> (H, W, C)
|
| 437 |
preprocessed_numpy = image_tensor[0].permute(1, 2, 0).cpu().numpy()
|
| 438 |
|
| 439 |
-
#
|
| 440 |
-
tensor_h, tensor_w = preprocessed_numpy.shape[:2]
|
| 441 |
-
region_mask_for_features = cv2.resize(
|
| 442 |
-
region['region_mask'].astype(np.uint8),
|
| 443 |
-
(tensor_w, tensor_h),
|
| 444 |
-
interpolation=cv2.INTER_NEAREST
|
| 445 |
-
)
|
| 446 |
-
|
| 447 |
features = self.feature_extractor.extract(
|
| 448 |
preprocessed_numpy,
|
| 449 |
-
|
| 450 |
[f.cpu() for f in decoder_features]
|
| 451 |
)
|
| 452 |
|
|
|
|
| 436 |
# Convert tensor back to numpy: (C, H, W) -> (H, W, C)
|
| 437 |
preprocessed_numpy = image_tensor[0].permute(1, 2, 0).cpu().numpy()
|
| 438 |
|
| 439 |
+
# Pass region_mask directly - feature extractor handles resizing internally
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 440 |
features = self.feature_extractor.extract(
|
| 441 |
preprocessed_numpy,
|
| 442 |
+
region['region_mask'],
|
| 443 |
[f.cpu() for f in decoder_features]
|
| 444 |
)
|
| 445 |
|