تست سلامت دیتاست
راهنمای مرحله به مرحله برای تولید نقشه حرارتی همپوشانی حاشیهنویسیها
import pandas as pd
# مثال: بارگذاری حاشیهنویسیها در یک DataFrame
annotations = pd.read_csv('annotations.csv')import numpy as np
def compute_iou(box1, box2):
# محاسبه تقاطع-به-اتحاد برای دو جعبه محدودکننده
x1, y1, w1, h1 = box1
x2, y2, w2, h2 = box2
xi1 = max(x1, x2)
yi1 = max(y1, y2)
xi2 = min(x1 + w1, x2 + w2)
yi2 = min(y1 + h1, y2 + h2)
inter_area = max(0, xi2 - xi1) * max(0, yi2 - yi1)
box1_area = w1 * h1
box2_area = w2 * h2
union_area = box1_area + box2_area - inter_area
iou = inter_area / union_area
return iou
# مثال: محاسبه IOU برای همه حاشیهنویسیهای یک تصویر
image_annotations = annotations[annotations['image_id'] == 'image_1']
overlaps = np.zeros((len(image_annotations), len(image_annotations)))
for i in range(len(image_annotations)):
for j in range(i + 1, len(image_annotations)):
box1 = image_annotations.iloc[i][['x', 'y', 'width', 'height']].values
box2 = image_annotations.iloc[j][['x', 'y', 'width', 'height']].values
overlaps[i, j] = compute_iou(box1, box2)
overlaps[j, i] = overlaps[i, j]مثال از اسکریپت بررسی سلامت دادهها
نتیجهگیری
Last updated