Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -354,7 +354,14 @@ class ForgeryDetector:
|
|
| 354 |
# Classify regions
|
| 355 |
results = []
|
| 356 |
for region in regions:
|
| 357 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 358 |
_, fh, fw = df.shape
|
| 359 |
|
| 360 |
region_mask = region['region_mask']
|
|
|
|
| 354 |
# Classify regions
|
| 355 |
results = []
|
| 356 |
for region in regions:
|
| 357 |
+
# Get decoder features and handle shape
|
| 358 |
+
df = decoder_features[0].cpu() # Get first decoder feature
|
| 359 |
+
|
| 360 |
+
# Remove batch dimension if present: [1, C, H, W] -> [C, H, W]
|
| 361 |
+
if df.ndim == 4:
|
| 362 |
+
df = df.squeeze(0)
|
| 363 |
+
|
| 364 |
+
# Now df should be [C, H, W]
|
| 365 |
_, fh, fw = df.shape
|
| 366 |
|
| 367 |
region_mask = region['region_mask']
|