2017-10-04 46 views
2

我是深度學習的新手。我有這個問題:我想用this data來訓練一個網絡。一切都在一個文件夾中,並且標籤位於不同的mat文件中。Keras圖像沒有子文件夾

據我所知,我可以用scipy.io讀取數據。但是我怎樣才能在一個文件夾中獲得火車X?如果我使用內置的flow_from_directory,它不顯示圖像,因爲每個類都應該有自己的文件夾。

如何僅用一個文件夾創建X?現在它顯示Found 0 images belonging to 0 classes

只有一個文件夾與圖像。所有圖像都在1個文件夾中。我的意思是沒有類文件夾。有了flow_from_directory,你應該有像汽車/奔馳,汽車/寶馬,汽車/奧迪,但我的數據沒有子文件夾。

所以我的問題是有沒有其他方式來創建X數據?

+0

請在您嘗試加載數據的位置發佈代碼,並更詳細地描述您的文件夾體系結構。 – displayname

+0

只有一個包含圖像的文件夾。所有圖像都在1個文件夾中。我的意思是沒有類文件夾。有了flow_from_directory,你應該有像汽車/奔馳,汽車/寶馬,汽車/奧迪,但我的數據沒有子文件夾。所以我的問題是有沒有其他的方式來創建X數據。 –

回答

1

link您還貼出顯示a download link爲「一個的devkit,包括類標籤的訓練圖像和邊框的所有圖像」。

您可以在那裏找到所需信息,以便將數據集轉換爲flow_from_directory()所需的所需文件夾結構。

README.md

-cars_meta.mat: 
    Contains a cell array of class names, one for each class. 

-cars_train_annos.mat: 
    Contains the variable 'annotations', which is a struct array of length 
    num_images and where each element has the fields: 
    bbox_x1: Min x-value of the bounding box, in pixels 
    bbox_x2: Max x-value of the bounding box, in pixels 
    bbox_y1: Min y-value of the bounding box, in pixels 
    bbox_y2: Max y-value of the bounding box, in pixels 
    class: Integral id of the class the image belongs to. 
    fname: Filename of the image within the folder of images. 
0

集類None,並把所有圖片到你的圖像文件夾的子文件夾一個。

例如:

  • flow_from_directory(目錄= 「/路徑/到/你/圖片/」,class_mode = 「無」,...)
  • 把你的圖像轉換成/path/to/your/images/data
相關問題