bounding box範例程式疑問
2020/01/07 00:07 下午
電腦視覺深度學習討論版
塔米
觀看數:2
回答數:1
收藏數:1
cvdl-1
cvdl-1-d32
yolo
我在看Day32_yolo_prediction_Sample程式碼,有不懂的地方,想請教老師:
1. cell 4的程式碼
boxes = np.array([[128, 224, 314, 537], [475, 85, 689, 170], [162, 119, 565, 441]]).astype(float)
# 把 bboxes 坐標以原圖的 resolution normalize 到 0~1 之間
boxes[:, [0, 2]] = boxes[:, [0, 2]] / img.shape[1]
boxes[:, [1, 3]] = boxes[:, [1, 3]] / img.shape[0]
請問在註解那邊以下,我看不懂裡面的[0, 2]與[1, 3]是指哪裡?
2. cell 7的程式碼
ij = np.ceil((cxcy_sample/cell_size))-1 # bboxes 中心所坐落的網路 index
target[int(ij[1]),int(ij[0]),4] = 1 # 該網格第一個 box 的 confidence 信息
target[int(ij[1]),int(ij[0]),9] = 1 # 該網格第二個 box 的 confidence 信息
target[int(ij[1]),int(ij[0]),int(labels[i])+9] = 1 # 該網格的類別信息
xy = ij*cell_size # 匹配到的網格的左上角相對坐標
# 該網格的 x,y,w,h
delta_xy = (cxcy_sample -xy)/cell_size
target[int(ij[1]),int(ij[0]),2:4] = wh[i]
target[int(ij[1]),int(ij[0]),:2] = delta_xy
target[int(ij[1]),int(ij[0]),7:9] = wh[i]
target[int(ij[1]),int(ij[0]),5:7] = delta_xy
第二行~第三行target裡的第三維4跟9分別是什麼? 我有看到同學提出類似問題,但想確認一下我這樣理解對不對:
a. 它所寫的4是指box1裡面的0~4,而box2裡面的5~9?
b. 若這說法成立的話,是否也套用在第8~11行程式碼?
以上問題請多指教,謝謝