Add width_r : local image width in a group
Check consistency of boxes wrt width_r
This commit is contained in:
+14
-4
@@ -250,7 +250,8 @@ def process_single_task(task_tuple):
|
||||
# List of (groupid, start, end), in pixels
|
||||
group_data = json.load(f)
|
||||
n = len(group_data)
|
||||
d_data = {l[0]: (l[1], l[2]) for l in group_data}
|
||||
# l[3] is ratio of width to width of group
|
||||
d_data = {l[0]: (l[1], l[2], l[3]) for l in group_data}
|
||||
total_height = group_data[-1][2]
|
||||
use_flash = n >= 4 or total_height <= 500
|
||||
if not use_flash and limit is not None:
|
||||
@@ -307,9 +308,10 @@ def process_single_task(task_tuple):
|
||||
if pid not in d_data:
|
||||
print("Error : Gemini answered a copie id not present", pid, label, group_name)
|
||||
continue
|
||||
yming,ymaxg = d_data[pid]
|
||||
yming,ymaxg, width_r = d_data[pid]
|
||||
if ymin < yming-50 or ymax > ymaxg+50:
|
||||
print("Error : Gemini answered box2d not at the right position", pid, label, group_name)
|
||||
print("Error : Gemini answered box2d too low/up",
|
||||
pid, label, group_name)
|
||||
if ymax < yming or ymin > ymaxg:
|
||||
print("Removing the box.")
|
||||
f["box_2d"] = None
|
||||
@@ -319,8 +321,16 @@ def process_single_task(task_tuple):
|
||||
|
||||
f["box_2d"] = [nymin, xmin, nymax, xmax]
|
||||
# print("Group :", yming, ymaxg, "Answered:", ymin, ymax)
|
||||
if xmax / 1000 > width_r:
|
||||
print("Error : Gemini answered box2d too right",
|
||||
pid, label, group_name)
|
||||
if xmin /1000 > width_r:
|
||||
print("Removing the box.")
|
||||
f["box_2d"] = None
|
||||
continue
|
||||
f["box_2d"][3] = int(width_r * 1000)
|
||||
|
||||
# --- CRITICAL: Use Lock for writing shared data ---
|
||||
# --- Use Lock for writing shared data ---
|
||||
with io_lock:
|
||||
if label not in results:
|
||||
results[label] = [] # Ensure key exists if not using defaultdict
|
||||
|
||||
Reference in New Issue
Block a user