Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -354,18 +354,18 @@ class ForgeryDetector:
|
|
| 354 |
# Classify regions
|
| 355 |
results = []
|
| 356 |
for region in regions:
|
| 357 |
-
|
| 358 |
-
|
| 359 |
|
| 360 |
-
|
| 361 |
-
|
| 362 |
-
|
| 363 |
-
|
| 364 |
-
|
| 365 |
-
|
| 366 |
-
|
| 367 |
|
| 368 |
-
|
| 369 |
|
| 370 |
# Extract features
|
| 371 |
features = self.feature_extractor.extract(
|
|
|
|
| 354 |
# Classify regions
|
| 355 |
results = []
|
| 356 |
for region in regions:
|
| 357 |
+
df = decoder_features[0] # shape: [C, H, W]
|
| 358 |
+
_, fh, fw = df.shape
|
| 359 |
|
| 360 |
+
region_mask = region['region_mask']
|
| 361 |
+
if region_mask.shape != (fh, fw):
|
| 362 |
+
region_mask = cv2.resize(
|
| 363 |
+
region_mask.astype(np.uint8),
|
| 364 |
+
(fw, fh),
|
| 365 |
+
interpolation=cv2.INTER_NEAREST
|
| 366 |
+
)
|
| 367 |
|
| 368 |
+
region_mask = region_mask.astype(bool)
|
| 369 |
|
| 370 |
# Extract features
|
| 371 |
features = self.feature_extractor.extract(
|