目錄:
- 1. 圖片預(yù)處理
2. RPN網(wǎng)絡(luò)預(yù)測- 3. RPN to ROIs
- 4. Classifier 網(wǎng)絡(luò)預(yù)測
- 5. Classifier網(wǎng)絡(luò)輸出對 ROIs過濾與修正
- 6. NMS (非最大值抑制)
- 7. 坐標(biāo)轉(zhuǎn)換為原始圖片維度
一: 輸入輸出
輸入:
- omg: 經(jīng)過預(yù)處理過的圖像, shape為 [1, 600, 800, 3].
輸出:
- cls: 每個anchor在pixel上的概率, shape為 [1, 37, 50, 49].
- reg: 每個anchor在pixel上的回歸值, shape 為 [1, 37, 50, 196].
- feature: 經(jīng)過VGG16后的feature map, shape 為 [1, 37, 50, 512].
二: 流程
- 圖片BGR 格式轉(zhuǎn)換為 RGB 格式。
- 圖片縮放。
- 圖片均值中值化。
三: code by code
img 轉(zhuǎn)換為tensorflow 的 Tensor
Tensor<Float> input = TypeConvertor.ndarrayToTensor(img);
預(yù)測
List<Tensor<?>> output = this.session.runner().
feed(INPUT_NAME, input).
fetch(OUTPUT_CLS_NAME).fetch(OUTPUT_REG_NAME).fetch(OUTPUT_FEATURE_MAP_NAME).
run();
構(gòu)建輸出
0: cls
1: reg
3: feature
return new FasterRCnnRPN_Output(output.get(0), output.get(1), output.get(2));