91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 17KB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發布日期: 2021-05-24
  • 語言: Matlab
  • 標簽: caffe??matlab??

資源簡介

caffe的matlab使用接口的示例代碼及文件

資源截圖

代碼片段和文件信息

function?[scores?maxlabel]?=?classification_demo(im?use_gpu)
%?[scores?maxlabel]?=?classification_demo(im?use_gpu)
%
%?Image?classification?demo?using?BVLC?CaffeNet.
%
%?IMPORTANT:?before?you?run?this?demo?you?should?download?BVLC?CaffeNet
%?from?Model?Zoo?(http://caffe.berkeleyvision.org/model_zoo.html)
%
%?****************************************************************************
%?For?detailed?documentation?and?usage?on?Caffe‘s?Matlab?interface?please
%?refer?to?Caffe?Interface?Tutorial?at
%?http://caffe.berkeleyvision.org/tutorial/interfaces.html#matlab
%?****************************************************************************
%
%?input
%???im???????color?image?as?uint8?HxWx3
%???use_gpu??1?to?use?the?GPU?0?to?use?the?CPU
%
%?output
%???scores???1000-dimensional?ILSVRC?score?vector
%???maxlabel?the?label?of?the?highest?score
%
%?You?may?need?to?do?the?following?before?you?start?matlab:
%??$?export?LD_LIBRARY_PATH=/opt/intel/mkl/lib/intel64:/usr/local/cuda-5.5/lib64
%??$?export?LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libstdc++.so.6
%?Or?the?equivalent?based?on?where?things?are?installed?on?your?system
%
%?Usage:
%??im?=?imread(‘../../examples/images/cat.jpg‘);
%??scores?=?classification_demo(im?1);
%??[score?class]?=?max(scores);
%?Five?things?to?be?aware?of:
%???caffe?uses?row-major?order
%???matlab?uses?column-major?order
%???caffe?uses?BGR?color?channel?order
%???matlab?uses?RGB?color?channel?order
%???images?need?to?have?the?data?mean?subtracted

%?Data?coming?in?from?matlab?needs?to?be?in?the?order
%???[width?height?channels?images]
%?where?width?is?the?fastest?dimension.
%?Here?is?the?rough?matlab?for?putting?image?data?into?the?correct
%?format?in?W?x?H?x?C?with?BGR?channels:
%???%?permute?channels?from?RGB?to?BGR
%???im_data?=?im(:?:?[3?2?1]);
%???%?flip?width?and?height?to?make?width?the?fastest?dimension
%???im_data?=?permute(im_data?[2?1?3]);
%???%?convert?from?uint8?to?single
%???im_data?=?single(im_data);
%???%?reshape?to?a?fixed?size?(e.g.?227x227).
%???im_data?=?imresize(im_data?[IMAGE_DIM?IMAGE_DIM]?‘bilinear‘);
%???%?subtract?mean_data?(already?in?W?x?H?x?C?with?BGR?channels)
%???im_data?=?im_data?-?mean_data;

%?If?you?have?multiple?images?cat?them?with?cat(4?...)

%?Add?caffe/matlab?to?you?Matlab?search?PATH?to?use?matcaffe
%?if?exist(‘../+caffe‘?‘dir‘)
%???addpath(‘..‘);
%?else
%???error(‘Please?run?this?demo?from?caffe/matlab/demo‘);
%?end
addpath(‘G:\caffe\caffe-master-MS\Build\x64\Release\matcaffe‘);?%如果不行再改成加+caffe
%?Set?caffe?mode
if?exist(‘use_gpu‘?‘var‘)?&&?use_gpu
??caffe.set_mode_gpu();
??gpu_id?=?0;??%?we?will?use?the?first?gpu?in?this?demo
??caffe.set_device(gpu_id);
else
??caffe.set_mode_cpu();
end

%?Initialize?the?network?using?BVLC?CaffeNet?for?image?classification
%?Weights?(parameter)?file?needs?to?be?downloaded?from?Model?Zoo.
model_dir?=?‘models/bvlc_reference_caffenet/‘;
%?model_dir?=?‘../../models/bvlc_reference_caffenet/‘;
net_model?=?[model_dir?‘deploy.prototxt‘];
net_weig

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件???????5661??2016-11-19?20:32??caffe_matlab\classification_demo.m

?????文件??????31674??2016-11-18?22:17??caffe_matlab\synset_words.txt

?????文件????????598??2016-11-20?14:40??caffe_matlab\test.m

?????目錄??????????0??2016-11-20?14:47??caffe_matlab

-----------?---------??----------?-----??----

????????????????37933????????????????????4


評論

共有 條評論