在閱讀DeepLab時,發現paper中首先介紹了PASCAL VOC 2012數據集,然後又說使用一個augment後的dataset來進行訓練。論文中是這樣說的:
The proposed models are evaluated on the PASCAL VOC 2012 semantic segmentation benchmark [1] which contains 20 foreground object classes and one background class. The original dataset contains 1, 464 (train), 1, 449 (val ), and 1, 456 (test) pixel-level annotated images. We augment the dataset by the extra annotations provided by [76], resulting in 10, 582 (trainaug) training images. The performance is measured in terms of pixel intersection-over-union averaged across the 21 classes (mIOU).
接下來看一下這個original dataset和augment the datase的區別。
一、PASCAL VOC 2012 segmentation
VOC 2012官方已經說的非常清楚,1464 (train), 1449 (val), and 1456 (test)
.
詳細的分佈如下:
二、SBD dataset
所謂的VOC的augment dataset也叫作SBD,8498 (train), 2857 (val)
是出自這篇文章《Semantic Contours from Inverse Detectors》鏈接:http://home.bharathh.info/pubs/pdfs/BharathICCV2011.pdf
作者還提供了一個網站,http://home.bharathh.info/pubs/codes/SBD/download.html,裏邊介紹的比較詳細。
需要注意的是
- SBD數據集的圖片來自於VOC 2011的圖片(11355張),而VOC 2012和VOC 2011在數據集的圖片上同樣沒有變化,它們只是標記數量的不同。
- SBD數據集的train和val set和VOC是不同的,作者在上邊鏈接的網站裏說明:
Please note that the train and val splits included with this dataset are different from the splits in the PASCAL VOC dataset. In particular some “train” images might be part of VOC 2012 val.
即這個訓練集包含了部分驗證集中的圖像。
三、10582 trainaug
DeepLab中所用的10582 trainaug是怎麼來的?
參考這個鏈接:https://www.sun11.me/blog/2018/how-to-use-10582-trainaug-images-on-DeeplabV3-code/
這個博客裏提供了完整的如何在tensorflow中使用10582 trainaug訓練DeepLabv3:
- 下載VOC 2012 和 SegmentationClassAug,後一個文件是SBD提供的額外標註(
extra annotations
) - 從這個地址保存trainaug的文件名,創建一個trainaug.txt,然後複製進去。
用vscode打開直接拖到最後,發現確實是10582
- 最後用上面鏈接作者提供的腳本運行一下就可以得到10582的trainaug的tfrecord文件使用tensorflow來訓練了。
四、10582是怎麼得到的?
最後再看一下10582這個數字是怎麼得到的,先給一些數據:
voc數據集標籤:
voc_trainval:2913
voc_train:1464
voc_val:1449
sbd數據集標籤:
sbd_train:8498
sbd_val:2857
因爲我們有上邊所有數據集對應的文件名.txt
文件,通過對比其中圖片文件名重合情況,發現:
sbd_train(8498)
=和voc_train重複的圖片(1133)
+和voc_val重複的圖片(545)
+sbd_train真正補充的圖片(6820)
sbd_val(2857)
=和voc_train重複的圖片(1)
+和voc_val重複的圖片(558)
+sbd_val真正補充的圖片(2298)
所以可以得到的最大的擴充數據集應爲:
voc_train(1464)
+voc_val(1449)
+sbd_train真正補充的圖片(6820)
+sbd_val真正補充的圖片(2298)
=12031
張標註圖
用原來的voc_val(1449)
作爲驗證集,剩下的12031
-voc_val(1449)
=10582
都可以用作訓練,就是trainaug(10582)
參考: