Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -360,7 +360,8 @@ class ForgeryDetector:
|
|
| 360 |
print(f"[DEBUG] prob_map_resized shape: {prob_map_resized.shape}")
|
| 361 |
|
| 362 |
# Refine mask
|
| 363 |
-
|
|
|
|
| 364 |
refined_mask = self.mask_refiner.refine(prob_map_resized, original_size=original_image.shape[:2])
|
| 365 |
|
| 366 |
print(f"[DEBUG] binary_mask shape: {binary_mask.shape}")
|
|
@@ -440,7 +441,8 @@ class ForgeryDetector:
|
|
| 440 |
forgery_type = int(predictions[0])
|
| 441 |
confidence = float(confidences[0])
|
| 442 |
|
| 443 |
-
|
|
|
|
| 444 |
results.append({
|
| 445 |
'region_id': region['region_id'],
|
| 446 |
'bounding_box': region['bounding_box'],
|
|
|
|
| 360 |
print(f"[DEBUG] prob_map_resized shape: {prob_map_resized.shape}")
|
| 361 |
|
| 362 |
# Refine mask
|
| 363 |
+
# Lower threshold for more sensitive detection
|
| 364 |
+
binary_mask = (prob_map_resized > 0.3).astype(np.uint8)
|
| 365 |
refined_mask = self.mask_refiner.refine(prob_map_resized, original_size=original_image.shape[:2])
|
| 366 |
|
| 367 |
print(f"[DEBUG] binary_mask shape: {binary_mask.shape}")
|
|
|
|
| 441 |
forgery_type = int(predictions[0])
|
| 442 |
confidence = float(confidences[0])
|
| 443 |
|
| 444 |
+
# Lower confidence threshold to detect more regions
|
| 445 |
+
if confidence > 0.5:
|
| 446 |
results.append({
|
| 447 |
'region_id': region['region_id'],
|
| 448 |
'bounding_box': region['bounding_box'],
|