#poly_contour_pts为二维数据点
rect = cv2.boundingRect(poly_contour_pts)
x_start = rect[0]
y_start = rect[1]
x_end = x_start + rect[2]
y_end = y_start + rect[3]
#prob_class 维度为[ 类别 x featureW x featureH]
poly_class = prob_class.argmax(0)
roi_class = poly_class[x_start:x_end, y_start:y_end]
roi_class = roi_class.flatten().tolist()
type_ = max(roi_class,key=roi_class.count)
备注:
如果分类维度为[1 x 类别 x featureW x featureH]
poly_class = prob_class.argmax(1).unsqeeze(0)