日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

caffe:Data 层

發(fā)布時間:2025/4/16 编程问答 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 caffe:Data 层 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

在看caffe教程中Fine-tuning for style recognition時比較image_net和style微調(diào)網(wǎng)絡(luò)結(jié)構(gòu)時,發(fā)現(xiàn)兩個不同的Data layer的類型Data 和 ImageData,如下:

**name: "CaffeNet"** layer {name: "data"type: "Data"top: "data"top: "label"include {phase: TRAIN}transform_param {mirror: truecrop_size: 227mean_file: "data/ilsvrc12/imagenet_mean.binaryproto"} # mean pixel / channel-wise mean instead of mean image # transform_param { # crop_size: 227 # mean_value: 104 # mean_value: 117 # mean_value: 123 # mirror: true # }data_param {source: "examples/imagenet/ilsvrc12_train_lmdb"batch_size: 256backend: LMDB} } **name: "FlickrStyleCaffeNet"** layer {name: "data"type: "ImageData"top: "data"top: "label"include {phase: TRAIN}transform_param {mirror: truecrop_size: 227mean_file: "data/ilsvrc12/imagenet_mean.binaryproto"}image_data_param {source: "data/flickr_style/train.txt"batch_size: 50new_height: 256new_width: 256} }

查看文檔資料發(fā)現(xiàn),原來Data layer不僅能接受lmdb和leveldb格式的數(shù)據(jù),也能通過設(shè)置類型為ImageData,提供文件列表和*.jpg,繞過轉(zhuǎn)換過程,直接提供給caffe。
參考:http://caffe.berkeleyvision.org/tutorial/layers.html
中 Data Layers

Data enters Caffe through data layers: they lie at the bottom of nets. Data can come from efficient databases (LevelDB or LMDB), directly from memory, or, when efficiency is not critical, from files on disk in HDF5 or common image formats.

Common input preprocessing (mean subtraction, scaling, random cropping, and mirroring) is available by specifying TransformationParameters.

Database

Layer type: Data
Parameters
Required
source: the name of the directory containing the database
batch_size: the number of inputs to process at one time
Optional
rand_skip: skip up to this number of inputs at the beginning; useful for asynchronous sgd
backend [default LEVELDB]: choose whether to use a LEVELDB or LMDB
In-Memory

Layer type: MemoryData
Parameters
Required
batch_size, channels, height, width: specify the size of input chunks to read from memory
The memory data layer reads data directly from memory, without copying it. In order to use it, one must call MemoryDataLayer::Reset (from C++) or Net.set_input_arrays (from Python) in order to specify a source of contiguous data (as 4D row major array), which is read one batch-sized chunk at a time.

HDF5 Input

Layer type: HDF5Data
Parameters
Required
source: the name of the file to read from
batch_size
HDF5 Output

Layer type: HDF5Output
Parameters
Required
file_name: name of file to write to
The HDF5 output layer performs the opposite function of the other layers in this section: it writes its input blobs to disk.

Images

Layer type: ImageData
Parameters
Required
source: name of a text file, with each line giving an image filename and label
batch_size: number of images to batch together
Optional
rand_skip
shuffle [default false]
new_height, new_width: if provided, resize all images to this size
Windows

WindowData

Dummy

DummyData is for development and debugging. See DummyDataParameter.

總結(jié)

以上是生活随笔為你收集整理的caffe:Data 层的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。