Spaces:
Sleeping
Sleeping
Upload env.py
Browse files
env.py
CHANGED
|
@@ -43,11 +43,8 @@ def calculate_iou(box1: List[List[int]], box2: List[List[int]]) -> float:
|
|
| 43 |
return inter_area / union_area
|
| 44 |
|
| 45 |
class MetaOCTEnv:
|
| 46 |
-
def __init__(self, data_dir: str = "
|
| 47 |
self.data_dir = data_dir
|
| 48 |
-
# Support both flat root upload (HuggingFace) and local images/ folder
|
| 49 |
-
if not os.path.isdir(data_dir):
|
| 50 |
-
self.data_dir = "." # Fallback to root directory
|
| 51 |
with open(truth_file, "r") as f:
|
| 52 |
self.ground_truth = json.load(f)
|
| 53 |
self.image_files = list(self.ground_truth.keys())
|
|
|
|
| 43 |
return inter_area / union_area
|
| 44 |
|
| 45 |
class MetaOCTEnv:
|
| 46 |
+
def __init__(self, data_dir: str = ".", truth_file: str = "ground_truth.json", difficulty: str = "medium"):
|
| 47 |
self.data_dir = data_dir
|
|
|
|
|
|
|
|
|
|
| 48 |
with open(truth_file, "r") as f:
|
| 49 |
self.ground_truth = json.load(f)
|
| 50 |
self.image_files = list(self.ground_truth.keys())
|