Tensorflow 对象检测 API 默认情况下是否会进行类似于输入标准化的预处理?
我在任何地方都找不到任何有关它的文档。数据增强中有一个名为“NormalizeImage”的选项。在动物园模型的所有配置文件中,我从未看到它被使用过。下雨了ssd_mobilenet_v3_small_coco_2020_01_14
将学习转移到我的自定义课程而不使用它并且一切正常。
我知道有类似的问题here https://stackoverflow.com/q/51509083/4267439但几年后没有答案,网络也不同了。
使用以下代码(OpenCV 4.3.0 DNN 模块)进行测试会产生正确的结果:
import cv2 as cv
net = cv.dnn_DetectionModel('model/graph/frozen_inference_graph.pb', 'cvgraph.pbtxt')
net.setInputSize(300, 300)
#net.setInputScale(1.0 / 127.5)
#net.setInputMean((127.5, 127.5, 127.5))
net.setInputSwapRB(True)
frame = cv.imread('test/2_329_985_165605-561561.jpg')
classes, confidences, boxes = net.detect(frame, confThreshold=0.7)
for classId, confidence, box in zip(classes.flatten(), confidences.flatten(), boxes):
print(classId, confidence)
cv.rectangle(frame, box, color=(0, 255, 0))
cv.imshow('out', frame)
cv.waitKey()
While here https://github.com/opencv/opencv/pull/16760使用归一化。在我的例子中使用标准化会产生错误的结果,边界框比应有的大得多。我猜输入标准化是由张量流在幕后执行的?