Format of a .caffemodel file?

8,518 views
Skip to first unread message

Antony Zebraski

unread,
Jun 8, 2015, 4:54:21 PM6/8/15
to caffe...@googlegroups.com
I've read that a .caffemodel file is a binary protobuf file. If that is the case, how does one parse it?
Where's the protobuf definition for this file?
As an example, I tried to parse the "models/bvlc_reference_caffenet/deploy.prototxt" file, but
it won't parse as a proto file. How is caffe able to parse a .caffemodel file from "deploy.prototxt"?

Before I dive into the source, I figured I'd ask... :-)




sharath s

unread,
Aug 20, 2015, 7:36:16 AM8/20/15
to Caffe Users
Were you able to parse the .caffemodel and get the weights and biases

It would really helpful if you share, if you had figured it out

Abhimanyu Dubey

unread,
Aug 20, 2015, 11:16:44 AM8/20/15
to Caffe Users
A simple way to read weights and biases for a caffemodel given the prototxt would be to just load the network in Python and read the weights. 

You can use:

import caffe

net = caffe.Net(<prototxt-file>,<model-file>,<phase>);

and access the params from net.params

sharath s

unread,
Aug 21, 2015, 9:27:46 AM8/21/15
to Caffe Users
Thanks a lot for sharing

DeepMe

unread,
Oct 16, 2015, 3:39:10 AM10/16/15
to Caffe Users
I have A problem with my caffeModel binary file. A can't read properly this file with caffe library compiled in windows.

I made train processus under ubuntu and when i want to use xxxx.caffemodel in windows, ifind that the number of layers (layers_size()) is zero
There the content of binary file obtained with caffe library compiled under ubuntu:

name: "CaffeNet"
100 {
  1: "data"
  2: "Data"
  4: "data"
  4: "label"
  8 {
    1: 0
  }
  10: 0
  100 {
    2: 1
    3: 227
    4: "/home/deepworld/CAFFE_ROOT/data/imagenet/image_mean.binaryproto"
  }
  107 {
    1: "/home/deepworld/CAFFE_ROOT/examples/imagenet/image_train_lmdb"
    4: 256
    8: 1
  }
}
100 {
  1: "conv1"
  2: "Convolution"
  3: "data"
  4: "conv1"
  6 {
    3: 0x3f800000
    4: 0x3f800000
  }
  6 {
    3: 0x40000000
    4: 0x00000000
  }
  7 {
    5: "\024\234\013=\341~\010=\332\0250=F\007\034=\352Oi=\n4o=\377\277\221=#\215\200=\237A\203=\t\340e=\205n\\=!\347\347<[\377\245<i\334\305<\217\310\346<\277HM=96d=\303\325O=\177\353K=\245\200B=\006\300,=XV==\026d\017<\020\251r<y\177\276<>\321\257<\347\224\344<\274I\322<\204\227\027=C,,=\315\"\347<\204\217\n=\301\247\227<z\225\021<\254\263\374;\243]\200<KO\220<\3572\216<y\330\314<\347\017\244<3\n\265<\372\254\324;\343\363a<Y\337\321;\241}\255;\360\263\364:RXN9n\325\004<I0\303;A\315\316:m\005\311\273}\334\222\274\016\322n\274`O\230\271\0273>\2743\2776\273\305\2113;/m\321;\374\240\200\274\025\376\362\273\"e\201\274\2112\243\274\313A\004\275\325\017\240\274\353\327\252\274E\023\266\274\216\307A\274^\351<\274>\300\356\272\335\254\\\274\352\231\216\274\274\217\017\275\324z\021\275\006E\033\275\t;\022\275\026\214\341\274Bv\r\275\317\230o\274\354\010\272\274\026w\264\274\206&\224\274?\021\230\274\274\257@\275\247\351\004\275\021z>\275E`\037\275p\270\013\275\250g\006\275\331%\225\274\240\203\244\274.\226;\274j\252\231\274\253\\\'\275\036\014Q\275\321I$\275\265H<\275fYD\275\005\363\352\274\222z\353\274\333|x\274\007\352\217\274\231\233T\2743a\352\274\232\3652\275p\347K\275\324*J\275\345\314P\275\316\321b\275\333c\035\275t\214\t\275o\367\222\274\232\361\275\274Z\224\002\275\350ZA\275\017\tg\275<\250O\275\277\205S\275\315\346~\275\017iR\275\306d\t\275\253\316.\275\016\311\257<v\360m<<\014\361<\362\312\233<\324\263\274<\346a\021=S\024\n=\210d+=l\305\352<\234\242\360<\007\256\010=GA\271<\365h\250<\207O\352<1I~<U\231\313<\313\206\243<\204\373\026=\253_\333<7y\317<tZ\330<N\251\212<\246\036\247<\235\372\034<\037\246\226<3J\274<,\000\312<\212H}<{\233\314<2!\265<\t\217\225;\224\030\254<\336H*<bt\223;\306\333?<\037\217w<\360i[<\005\r\350<\262\352\255<\220\007\223<\315\352\217<\363\334\305; \247\321\270\334\3702<L\016\235;\010\0030<\0343B<\026\316\217<\360\241\213<5\335i<\332\364];d\205J<J\347\032\274\222M\346\273\210\332\302\272\327\304\034<I\000i<\342\273g<}\t\216;V\r\247\273_\247\010\274\236C\014\2748=/\274\327{\227\274\242\204f\274!!\332\273\303G\255;J2\267;\260u\225;\2361\364:s\272\014<Nm\351;>27\2746+\004\274\036\226c\274\274\234\262\273\271\220\203\274\333K\220<\0269\331<\"\325\217<q\262\376;\035\003Y<\302n\222\274\272\025k\274\013e\232\274\221\257\220\274X\272\304\274\260\214-\274u}o<\25547<^8,<\037~\037<<\025\365;\223\350,\274\257,\211;@\250\022\274\026q\261\274\327\254R\274\004\312%\274\304\314\026<\032\210\016<(\217\316;\217LO;\354w2<%8\321\273n\213T9\365\363V\274y\361[\274&&/;v\334\245;\016R\352;\353\254\315<\335K\224<\261\303\204<\272;\374:\202\377\223;(~\202;\005D\257\274\035(\272\273\355\0350\274\006x8<\203\367g\274\023Z\264\274\325\257\216\274-Q\344\274\231\335\246\274\254%\246\274\3670\262\274h\017\223\274\347\270\n\274\364\225\210\274?o\210\274\363\371\324\274\313t\333\274\241~\264\274HI\"\275\3112\001\275\240\264\306\274\240%\222\274iE\256\274\\\337\027\275\"\034\275\274\203\240G\274\\\313\267\274WM\257\274=\250\t\275\216l+\274\343\302\316\273-|\364\274\224\212\217\274d\356\256\274\211\317\024\274\202\366\336\273\262\273\030\274^\261\242\274\027\037\227\274f72\274\230J\001\274|\312\206\274xW\214\274.\266f\274\213\243\206\274Q\344-\274s\227W\274^\234I\274U4A\274\223\320\312\274\367.\026\274\224b/\274\346n\362:\324K\272\271\n0\t\274n\354|\273\205\232d;8\317\247\272\271\237\252\273\324P\203\274\260\2173\274Hj\032\274\237f\030\274\351I\201:\014G\215;\33642:lb\245\273\301v\2059\352b\357\271\346\200\215;\016Ra\272\027\335\221\274\274\023\216\274\217\262\242:U\014\305;\347\257_\273\021\363\'\273\316,\210\273^V\374;E~\303;\223+\370;\234\332\355\273%\343G\273~DT\274\362o\310;\341\242\230:cA\301\273$\233r<\246\235\004<X\031j;\311}\t\273+\357<<q\\\251\274\361\342\022\274\366\035\333:}\254Q\273\226U\016<\347\r!;\234S\366;\372U\304:\023\300\257;\242\255\336;\n\264\002\273\267\031|\274\247\273D\274&N\005\274ES,<\257>\007<\035\343\006<?\354\207<\332\257\204<\374B\243<\320\343\212<\311y\236<\224\316\214:$\361\225\273\340*B<\314\264\233<A\234\253<\227\034\257<\3426\374<\360\243\t<Z\345\226<n|\177<Nu\000=9\263\210\274\354\006\241\274\262\360\247\274\230}\265\274\207\227\231\274Xk\317\2748\262\341\274\305L\331\274o?\266\274:k\311\274#\306\r\275>\355\214\274\231\325\327\274\230q\022\275~\367\264\274\026,\316\274\255\377\231\274\226\315\304\274\260\347\357\274\006\363\343\274\3355\266\274\3023\307\274\245pY\274\221\300\223\274\346\025\304\274*\242\303\274\374[\355\274\217\004\321\274{\307\304\274u\257\356\274\255\300\000\275\343\017\026\275\346\317\320\274\342\354\333\274\361\363\255\274\330\277\347\274o(\322\274\252\021\342\274p\244\274\274\330N0\275\347\375\351\274\"\374\353\274,\256\272\274\2762\014\275[M\275\274\235]\004\275\300^\353\274pB\375\274\3171\021\275\244 \321\274\"\312\272\274K\370\242\274\315\377\320\274\035\301x\274\020\234\356\274\242(\337\274\234\273\372\274k]\025\275\364D\354\274\270\246\235\274\224\323\351\274w`\370\274\014A\361\2749\263\301\274\205b\353\274\020O\002\275\242W\366\274{\355\007\275\306L\363\274\200X\253\274\022;\311\274>\302\263\274\225V\350\274\246(\022\275\367[\006\275\320W\017\275\251\303\210\274/+\226\274J\265D\274\373\252\277\274\206O\024\2755\005\326\274\354k\235\274r\320\272\274\006O\321\274Ct\024\275\336\317\355\274\301[\320\274\276>\251\274\225\230\332\274\250\326\336\274&j\212\274\370\200\340\274vi\315\274\226\304\221\274\267|T\274\177\223\321\274\372\375\023\275yG(\275\313\030\262\274\257X\244\274_\303\020\275CQ\300\274\262\377\274\274l/\311\274\211\320\301\274$\327\244\274\225\352\260\274{\247\241\274K\330\351\274\255\010\204\2740VG\274\240\020P\274\344\023\013\274\311\236\252\274Z\245|\274\325\226\267\274I\356\212\274\323\005\203\274\0049\203\274\n\243\232\274\020\237\351<_$\013=\344\357\025=\371\300&=.\2066=H\223\024=\300\325D=)\'+=\372\266\024=D\332\027=\313\214\224<\251\326\364<\362\353\'=\023\323!=\354\0268=\204\2409=\374Y*=@\304A=\223cF=\323V\034=\373\267\021=\026\021$=\016b)=h\350\210=\006\306^=\']V=t\374B=\312j3=\242\222Q=?\220\016=\242k9=\366(;=#\177\026=\201~9=\3572R=\266\331O=\0067~=\357\364r=\234\006H=\244\2765=\214_K=\013\241$=z\0334=/\346\005=\2002.=\342\3568=\362\3150=\265\256|=\270\365T=X\246.=\212D`=Q\345Y=\033\242j=\236\336\037=Z>9=\374\0324=y\211N=\344D9=sld=;\361}=\273\357.=B\327#=\251_@=<\260j=\213\177`=)z\017=D\371C=D\035c=35,=\010\303?=[\027j=\032\006e=+SR=O\216x=\245\361\027=j%/=\217\305G=\273\0071=f}@=\021GR=w\367,=\252(:=\232\230B=\017\2710=\220\254L=!\020E=\310BP=\351\027P=8\373/=\300\0269=mZJ=\324>h=\2734P=\205P_=y\353L=G\307)=$\264\025=\242\212!=\305m9=\215\250$=\204\236\007=$q\020=L\254\003=k\2668=:\317\034=\352M\"=\371\377D=\\\361G=I\237H=\343\240\026=\254\253\026=\365J\024=3|*=\037\234%=\027\231\"=\367\230#=B\370#=L\350\"=\303c$=\021d\020=\202i7=\004\262\355\2745\224\023\275R\211\'\275\224\366#\275t\334\022\275\357p\013\275\017>\261\274y\335\206\274\2037\n\275\224\363\314\274\334T\343\274\237\327\334\274V\022\254\274a\301\365\274\3053\034\275\024\312z\274?\225\224\274$J\363\274P\025\326\274\t\212\003\275o\334\217\274Y\361\267\274\035]\255\274\334\355.\274Q\206\237\273\343\307g\274\310\357\002\275\013\245\352\274\254[\026\275y\212\272\274h\342\010\275\262W\034\275\361a\027\275FC\353\274\226\312\303\274\304\326z\274_<\300\274\302\331\302\274\'_\260\274\025;O\274\034 \325\274L\213\365\274?\215\363\274=\352\254\274\201\355\004\275OU-\275\210\312\022\275s\261/\275dF\370\274a\277\227\274J\336\344\274\216\377\n\275\372P\327\274\025J\223\274\324\257\342\274\207\235\314\274vO\255\274G\t\364\274\273 \324\274\273)\272\274(95\275\235\027\361\274\232e\334\274\374$\273\274%\310\313\274f\320\351\274\201\013x\274\277\202\205\274\327i\305\274W7!\274\002[\257\274K\251\242\274\357\333\352\274e\247\332\274\032#\031\275\251\221\352\274\n\037\304\274|m\345\274\334A\250\274\364*\326\274\214\221\371\274\331\353\357\274\325\242\222\274\225\270y\274\357\352\017\275R\021\346\274\227\002\236\274\004M\276\274\013\330\341\274\024\306\022\275\326Og\274\277z\224\274\376>\363\274\367:\333\274\350\035\227\274`\031\311\274\266\032o\274&\367\016\275\034\305\360\274X|\375\274\310}\257\274\360\211\327\274\256R\027\275\221\221\310\274s:\301\274@\025\270\274|\355\242\274\207\333)\275\021\214\001\275\2740\022\275\344\272\363\274\315\372\244\274\322V\371\274\271e\326\274\\`\010\275e\026\377\274\2005\036\275\272\300\354\274K\"\365\274\365\371\006\275\337:\312\274\307~P\274\305\374#\275\360\247J\275\355d\'\275\226\351:\275\362\347Z\275c\350J\275N\320-\275\233\365\021\275\372]\210\274>\224\342\274\314;\367<*\327O=\000 9=;\2345=>7s=tHc=]!6=N\"\216=\306\212X=\324\026)=V\226b<\006\307\205;\213RQ;R\237\220<\361P\004=\021H\033=\341\037\t=\342n\363<I\317\315<\271\374\240<%\2166<1\007s<H\246\016\275s\274E\275\225\004i\275\272p\203\275\250\022\226\275\271a\224\275Te\227\275\344b|\275\316#y\275_$\231\275\256\356\022\275r\225\213<.Xv<\320@\227<0\311\247;\336\364\370\271@\236R<\261\020\213\272tQ\347;~6\r<j\306=<\234H\225<j?\000\273`\207\205;\030\304\214\274\206\266\007\274\304\375\016\274\313uN\274\361`\222\274\343\362\204\273w\335\201;\332&H<\243\'}:\005\2415\273\037\264\344\272\377*\246\273\361\326\346\272\216\371b;\3363\365\273\254>\206\274j\332\304\274,\217\232\274e5\006\275T\356\022\275\204K\367<\342 &=\004\t\221=)\354\263=\352\322\323=\331\t\375=\313F\017>\345x\017>[/\013>\177\250\275=\323b\230=n\324\372;\305\2753;#XH\274\033\221\252\2746\014\022\275D\224*\275\\\327\230\275\344aE\275\367\013G\275\225 h\274\220sK\273\233;\265\274\024xf\275!\227\227\275\340\354\277\275\256\035\317\275?\204\315\275\001\300\300\275Pz\263\275\220\257\200\275\314bK\275K-\330\274\252\000\030=)}e=\211\373\220=\375\205\261=\360{\312=\321t\307=*\340\250=\342\364\243=+\214\220=\024b)=\217I\377<\225\337\317\273\006\335\264\274\214R/\275\243\210=\275\364{\021\275,?V\275\317\370U\2750\026C\275\206_+\275\260E\000\275)\301j\274\262\264\020=K\322\203=\254A]=n\034\205=%!\236=\211\311\234=yi\210=f\354\250=\325\363\227=q\276P=\213\356\302<W\211\266;\370\324|<N\354\312<,/:=\001\261\206=|+k=M\001c=5d\027=wi\014=-9\344<\026Z\352<\240\262\010\275s4;\275\246A\037\275(\271\220\275\321\002\263\275cO\246\275?\235\236\275\204\315\256\275_\031\265\275\253\216\222\275\026$l\275\224\333\206<@OK;\276\251\220<\231\311\221\273\001\013\3528\314\273\030\274\006\224x\274\241\361S\274\317R3\273-\023+\274\t*\232\272\316\277\377\272\267\331a\273o\350V\274\037L\337\274 a\234\2748\201\345\274\314\\\014\275\017\3153\274\335\272g\274\215\235\221\273S\335\202;\361\027\013\274\303\022\276\2731\022\241\273\330J\026\273\201\221\252;\347.\360:.\003m\274FQ\022\2753})\275}\206\033\275\320\217/\275\255\037\304<`z;=\272>\227=y\020\306=\337\233\357=\303\001\016>\006\226\033>\200\177\036>\253\321\002>-g\331=_\320|=\250\264\026\274\025\025\337:M\230X\274:\213\342\274\272OL\275\017\300b\275\260>\211\275\371\275I\275\317\336I\2756\033c\274\"D\363:tz\023\275w\347t\275xP\266\275\316b\341\275\303J\342\275\273\331\334\275\203\304\324\275\351\344\322\275]\370\264\275\226He\275c\255\341\274CE\013=\'2K=\222oV=\000\211\224=vC\260=\016\267\245=\3538p=\264\370\204=d\207\025=\226\301\223<\204\231\233<K\351\267\274p\0308\275\212\343H\275\177&`\275\350\243t\275\371%\213\275<\245C\275\300*T\275\231e\037\275>%+\275\261\226\305\274\245\343\356<}M%=yQZ=_\360d=E>R=\035\216\177=\026\020\201=tF\211=\314\264\204=\032\347<=.\035f<\226L\352;\354\327\320<\177\354\250<\333\005*=i\247Z=Cr~=\272E4=\363\321\032=\2703\023=>\272\312<\n\352\366<\255z\343\274\222\373A\275{\327\200\275K\245\223\275\351\266\247\275\001\367\245\275C7\200\275\344\267\213\275\320F\215\275\270\307]\275D\237$\275\352\272\032\273\335.;<\371ys<\247Y\014<P\304\302;9\234w;R\260^<\r\021\013\274\006\002\327<\202^\217<\277\261\017;\010H\343;\213N\321;\225E\253:\302\206\221\273\247\353\234\274hg\222\274\302X\355\274\322\"\023\272r\220\327;\374H\035<Kn\306\270\021\253X\274\316\335\004\273\260Hq;w`\377\273\373\316J\273\007WU\274\311\317a\274\24645\275?>>\275\362H;\275:\332M\275\0322Q<D\367\036=\320\227\214=-_\273=\241\345\302=\024\347\347=>\025\020>n\241\005>\031\331\357=Z\307\275=\025\013\200=\374\237v\273\274\322V\274\356m\207\274\262\315\016\275D\300\\\275a\377`\2750\362\201\275z\n\213\275\237\270\026\275\200 \323\274KHC\274=\230`\275efz\275\214:\233\275\305\353\273\275\"!\314\275\234Z\350\275\271\202\266\275@\013\266\275\311\261\235\275]Gu\275\342\272\n\275\352h\372:5e?=\t\243[=K\234}=\351\022\220=s\256\213=\034\337\211=cO`=v\227+=\377\233\260<\202\352\362;\345\201\255\274\277\307\311\274\225>\343\274fH\255\274\263C\201\274\275x\352\274\330\317\347\274`\263\237\274\0073@\274\223GL\2740_\343\274B\241\240\274(4#\275\256\241\376\274\007\031\034\275$\210\034\275\004\235\361\274\207n\032\275\203\3059\275\353\325\375\274\372;\305\274\342\031r\274`\275y\274b^:\275\2526V\275\312\314\241\275EE\247\275\020\206\235\275\222\244\234\275m>v\275\316\350\\\275\321[\257\274\247O/;\003\320\266;\207\270\244\274\016\260\005\275%\213S\275\301\357p\275\233\270T\275\317![\275\331qH\275\305E\240\274Z\273O\273\336\212\036<ky9=h\026\362<\021\240Y<\225[\303;Y\323\350<\223_\177<\322\337\222<[B\201<p\213\034=\266\371\220<\036+(=@\317\207=$[p=\236\017\214=\214$\212=\322\322\241=\221Q\234=m}x=\350\342\216=\332\355\245=\240\026\224=2Rz=\004\227\235=2\215\220=%\233\225=\332V\235=[\244\321=\332\253\313=k\r\313=P\247\270=\031\020\273=\241\373\243=\370\312\246=\245M\267=hi\224=\037\335\243=0y\302=\373\241\277=5 \311=|\212\310=}\236\264=\000z\263=q\207\237=\271:\227=\306i\231=x\026\226=\230\204\236=0?\220=m\244\233=\275\375\223=g\003\225=)\272\222=\374\r\241=\255as=\355O\226=\003\337\205=\232\260X=\262\2064=\t\336l=\234\214z=\t\342m=\247V\213=\350\317o=\213\366@=\327\367[=\302{~=N\331T=\355\001G=\003\340\020=*\017&=\271\374\354<\0345\263<\315\321\275<\317\243\020=~=\030=\220\032\n=\205\352<=\3236,\275\272\317\023\275N<,\275\364\266\002\275\261^i\275F\020X\275\\95\275\260.N\275\344\312_\275\261\020\r\275\000\010\030\275\324\344\232\274`\3434\275\'\035(\275\177kP\275D\235t\275\315xW\275\36302\275\236\316C\27589R\275\342p/\275_{\370\274\316Q\017\275\336\224)\275\272=\207\275\007r\242\275\322\332\246\275J\214\271\275\240\327\230\275|\237\207\275\364\002f\275\375\335\024\275\377\036\302\274\210\026\017\275a\257=\275\005\271\222\275\254;\251\275g\275\241\275\332\006\236\275\214M\247\275\236\360|\2751l1\275\335\326\025\275\2562\311\2744\310\312\274\320\361\215\274\271E\317\274F@U\275\336;8\275\277\337\022\275\355\364A\275\353\240\017\275J\314\361\274Z\007O\274\010\272F\274\253\330\200\273\026Lh:\316\221\214\273\220\237\251\273\352zi\273\376\303m\274f\032A\274}j\327\273?\214`\272_y2\274\357\364\365\273\333|\337\273\206\216%\274\302\355\244\273X\024\364\273\303Q\371:\226D7\273\235\305\274\273\353\367>\274o\300}\274o\215\027\273\235\250\277\273\276\303\311\273S\265,\272>1\241\273Jw>\272E\204r;7c\326\273\330\370\'\273o\347L\274\024\013\241:\226\313\257\274\201m\220\274\262\n\271;4W+\274 m\347\273\016\205\304\272\263\351Q;\036\322\306\273k\330\212\274Jge\274\260\260\206\274^\310\271\274\235(\205\274\226\266\204\273bz.\274\272C\214\274|\337\352\273\300>\000\274\307e\206\274 \007\233\274!O\274\274p.\260\272\244d\231\274J\302\005\274Y\035\3559\276]\267\274\274~\335\274B/\337\2745\241\302\274\234\213\314\274,\312\326\274l\340\336\274\002\013\303\274\000\\\275\274\245Y\033\274\214[\266<\n\242\360<\222\204==\274Q^=\277\020\202=\307\300\017=\037\024H=6\014P=\3769l=[`\r=\266\200\314<.\266G=\"\235h=\372\273c=\245\217\216=\326\246\227=\3778\263=\332\312\217=U\310\206=u\222x=\354\210O=\201M,=\t\311.=\265\233;=?\027Z=\323Fq=\375\250\\=\342\021V=\376\204d=\331\222(=\272\262I=[E\002=\016\t\350<\253\205\216<O\337\332<\031\276\274<\024g\377<7-$=\260\275\315<\273\034\005=\332*\"=\210p\023=\275\340\235<\256\377\371<P\237\221<\272\223\317;!(\315<:3\367<<\\\351<\0006\003=\237>\341<\275\304\026=\201*\242<`\354\226<\036&7\273*j\231;\352\277\221<7\272\323;\273sz<\030P|<\212\226\255<\\\201\365<\277\205\001<\325\237\001<\242\244\001<\nMt;k\312_\274\215b`\274L\347\267\2742H\211\274\312\353\001\274\n\325:\2745\202R\2748\277H\274\224\337f\274\245\307\200\274\250\017\257\274\003\257\"\274.ek\274\364Z\343\274k\"!\274M\325\220\274\211\246-\274~\241\264\274\244\023t\274G\203\261\274\353\020R\274\007\243 \275_g\241\274\206\263\221\274\374\221\241\274=\351\201:\346\'Y\274\376U\347\274g[\370\274\357l\204\274\374Z.\274\313h\301\274%\000\013\275\021\221\377\273\346\034\206\273\370\251&\274\224\262P\274\257\035\234\273\202rH\274\311\257.\274\206B\033\274fDI: :0\273\341;\316\273\2051\230\274\375\357\223\273\2215\202:\275F\270\273\263B\013\274\260\356\243\273\272\302\303\273\037\013B\273{R\233\274I\347A\274\310\226\030\274\255\334*=\351\2227=)\3077=\\\023]=p\341R=@kc=\202\347c=h^G=\n\314i=\004n\026=\035n\030=\246m\307<\021q\027=\300\242G=\341\263Y=H\242\\=f\331$=\"\303D=\033\225,=\367\272K=;\310\000=\320\265\261<\263\034V<\030?d<eU\252<1S\361<\211/\010=\232\022.=@\276\302<\010,\247<\332\224\244<?\304\343;&\327\346\273\202\030\031\274$\t\214\273\226!\264;\\K\337;6,\231\272w\'m\274\206\342\027\274:_\226;\003\017^:\300-\377\273\330:\342:\021\315\006\275\306\034\370\274[\256\r\275\233`\003\275\264\307\007\275w\261\"\275\221\262\355\274\202\343&\275\264\334\311\274m\271\n\275\306\203\355\274\000!\374\274\373\016\002\2752\007p\275\374\r\203\275z\014\201\275Y\375\211\275KM\206\275\024\264z\275\223u.\275\006$g\275\266\031V\275Y\330-\275@\274:\275\317\376c\275u\371\224\275\234\226\213\275\000\322\200\275\251\025\204\275\210\214\226\275G\001v\275\322\t~\275r\250|\275\253\372\'\275\364\226s\275\320BR\275\342,q\275\037\366|\275%\214t\275\250e\211\275*\354|\275G\006b\275\331\254U\275\350\226[\275\2241l\275[\350]\275\177\220\211\275\273\261J\275\336>S\275\276\360P\275\263\262E\275u\360N\275g\271%\275\302\373E\275\270\314m\275\356\r\201\2758\017\213\275Y\232R\275%\204Q\275NgJ\275\342)i\275v!]\275X\346X\275\235iY\275\025\233T\275\262\314j\275~~\210\275\235h\213\275\226%^\275\226Br\275]\034\200\275\205\252\214\275)if\2751z~\275\257\036r\275\360\200O\275&r\221\275\306fV<0\017\242<\324L\221<\373}\346;\247\344\304<\220m\312<\217\214r<\244\232\227<}\003{<-t\242<\022\036\240<N\265\232<\\\340\206<\"\244\205;\337m\265<\351\264\335<\315\345\225<-p\203<\310\225\271<Q\320T<\233-\266<\274\211\252;\267\302i<\336\357\204<;\327\330<z\022\311<\242\326\244<N\241\234<\302+\235<\205\301\213<9\214`<\366fH<\261\321j<H3\237<\036\304\273<\350\334\026<\257\024\364<\213\263\257<YS\326<\241\330\244<\336O\352<\222\r\001=5d\347<\306]\005=@6\027=\371\t\363<0 \261<\336\345t<\361\227\342<\300:\360<\351H\310<\034\007\000=h/\370<\261\022\361<\357\022&=\337\305\007=\3735\"=\334Y\034=\264\356\363<\203\331\330<fe\356<T\326\305<\025>\n=sD\274<\274\214\342<dK\355<\251\206\016=.\2156=x\364\374<\210\222\022=9\326\030=\257\307\006=\201\317\031=\347\360\004=\2706\'=\3324\"=\333\237\n=\254\372L=EsS=\275\214d=A\371K=\022\263D=\247\026E=-gT=\303|\n=U/U=F\353V=\317z3=\357\220\037=\235\270@=\212F5=q\241\'=\272\tC=\027\3574=\260#8=\365\2768=\243\214\037=Y\204?=\364\0068=\260\241\014=XG5=\332\345\021=\022f4=\350\273D=\323\354\335<\334J<=?\201/=^}H=\236BM=\026\255N=#-/=\375gC=\301\2635=b\351\r=\241<\027=L\2735=\254\211\033=\257\374;=\010\224/=\356\360A=M\2119=F\016\013\275\005\2409\275+T:\275\215\312D\275\t\3167\275ghI\275\003S;\275\355\276<\275\274\203\023\275\351\340\363\274\235\317,\275\347W>\275\374\034\031\275\032\200D\275\323ff\275a\251=\275\362\2641\275>\211T\275C\317o\2751\210M\275V\217B\275H\276\037\275}j\007\275\207\206\035\275\332()\275\260\226\373\274O\367\360\274\222<\376\274\3274\032\275\3228\006\275\245R\004\275\330\306\024\275\373\251\031\275H(\225\274\231@\212\274G^\234\274\231\n]\274\202\212r\274\t\234U\274\007%\367\273]@\254\272\231\301\330\273\245C\203\274hy\336\274\334\230\\\274\243-\023\274O\314\034;\372\253\214:\177\003\026\273F6\361\273\357\375\374\273\345F\245\273\2409\024\273G\"A;y\nn\273\274s\027;i\262I<b\t\276:\324?d;6\014\023<\014]q\272\204\005!;\330l\235:E\203\245<(\275g\273\3629\304\273\264\203\010<\207\266A;\022\202f<*\205\377;\234,@<\323G\303;\235\275r:\363:\357;\310\352\035;\346\253\357;\220\303/;\276v\347\273(>X<}<A\273\235\242M<*\030\232<\n\356\341;\303P\230:`\0161<c\242m<Y\376\343;@\014\221\273H\024\224<Y\010\031\274E3\247;\\\n<\273\327\372\036<\006\352\224;\274\244\343\273\340+s8\010\271d:\312\251C;v\247\207\274\0021\347:\305\240\262;\211;\204;R\211\266;Qr\307\271b\250s<\234_\007\273\242a);\005\235\212;\254&\343\272\372\253\212\273c\037#<\246\013o<\264\245\300;~\343U;l]\317;\t\203?<\264\345\005\273\243\354\017:\246\244G<)\312\362\273e\321i\273c\244\026=N\315\274<\266\277!=\337e\232\273\333\004@\274\352+\027\275\361V\354\274\367\253\n\275,t*\275\324\007\341\273UA\361<\347\241e<\311l\263<\"\262:=\372n\247;\356\350\034\274\204s0\275\240\374F\275\357-3\275\322\017\014\275\271\262o<S\324\333<9\rz<\2718\224<j/\206=\014*-=\337_\272\273\327\207\220\275\362\273\233\275\307\254\210\275\014\227\033\2731\230\272<\317,\260<C\354\352\272\344/f<\2018f=\355Kf=\313ex<\335\221\227\275\235\360\023\276\337/\213\275!;\316<\255\026]=(\006\325<b\342\322\272N,K<\"+}=\0024\235=\331\250\312<\233\215\220\275\247L4\276\227\213\226\275+i\016=\271\023n=I\247\252<\352h\\;\375*\252<\261Cz==x\265=I\016\314<f\351\237\275\033\365D\276\267\004x\275Hp9=\261\251\213=\376T\014=\025\031\"<\242\005\262<g\n\226=\017\277\305=\237Y\303<\233\350\220\275\311\366%\276@\311P\275[\034@=\357\017\201=\"P\251<a(\220;W\224\267<d\256\206=\372\366\230=\350\226\t<P\n\226\275\004u\023\276\244\226\212\275*\231\321<\366m-=\334\036\247<\301\013\345<:\n\220<\211\347:=V\314\224=03\313\273\036\226i\275\274\177\275\275\227\231A\275,\222\024<\320\347*=\245\r\261<P\225\315<\344\242\004=\361\257\204=\326\tT=\331\267\007\274\215\3348\275\014\304\213\275\366\327<\275)\233\237\272\307\362\314<\223\216\006=\367\205\341<\023_\262<\025\265%=\222G\355<o\275\247\274\212\200)\275xI|\275\217\277N\275\203H\327\274~\262\224<\325\242\300<\333\214\344;\255\325\020<\372Z#=M<X<\327=\277\272J\333\301\273\\\315#\274\031\007P\274\260r\242\274\215\331s;Q\312\350<OJ <\347\255\201<[\324+=\n\327\302<&\222l\2734d\345\274\010!\362\274\363\353\001\275\265f\264:\022\363\256<\272\272 =\265[+:\370\261\302:wza=z\220M=U\252j<\0274\'\275u\001M\275~3\006\275Y\204\275<\221\345\024=\314>\346<\330\n\350;\006\224\205\273R/_=8\202\210=\037\323\033=\262\2254\275%\010\366\275\265\035\016\275\206\252\033=&\3132=\311/\016=zD\311\272O\036\267:P\271G=w\034\272=\025\362\022=(\215H\275\177\223\036\276\364\t\020\275r$I=\304\345\204=\022\364\226<[e\330\274\237\334\354\272\005\255Y=\233~\260=\366\016\035=\371\256\206\275wm\'\276\246\315\022\275\337\275^=\3246\210=\366\246K<\361J\342\273e\332\352;1\267Z=\310\001\262=pG\326<\343@\223\275\321\001 \276{G0\275\"\346\222=\326\033x=\035\"\006=d\265\316\272\22
...................................

//////
I have a look on bvlc_reference_caffenet.caffemodel, the content it's more logical:

name: "CaffeNet"
layers {
  top: "data"
  top: "label"
  name: "data"
  type: DATA
  data_param {
    source: "/home/jiayq/caffe-train-leveldb"
    mean_file: "/home/jiayq/ilsvrc2012_mean.binaryproto"
    batch_size: 256
    crop_size: 227
    mirror: true
  }
}
layers {
  bottom: "data"
  top: "conv1"
  name: "conv1"
  type: CONVOLUTION
  blobs {
    num: 96
    channels: 3
    height: 11
    width: 11
    data: -0.0012135869
    data: 0.0032365269
    data: 0.0067056264
    data: 0.0013365269
    data: 0.00015098628
    data: -0.016105399
    data: -0.027094858
    data: -0.041366898
    data: -0.0404647
    data: -0.033410437
    data: -0.020661572
    data: -0.0015275782
    data: 0.0023613083
    data: 0.0127269
    data: 0.027090358
    data: 0.057741854
    data: 0.071556665


Can anyone help me please?

DeepWorld

unread,
Oct 16, 2015, 3:51:11 AM10/16/15
to Caffe Users
the same caffemodel works fine for a classification task under ubuntu.

Zeevik

unread,
Jan 10, 2017, 8:19:47 AM1/10/17
to Caffe Users
hey,
how do ypu get a caffemodel binary file? (as you showed in your post?
thanks

Leon Dong

unread,
May 24, 2017, 5:53:07 PM5/24/17
to Caffe Users
Hi Abhimanyu

Your post is really insightful. Here is what I get following your code:

OrderedDict([('conv1/7x7_s2', <caffe._caffe.BlobVec object at 0x7f7ce9e62fa0>), 
('conv2/3x3_reduce', <caffe._caffe.BlobVec object at 0x7f7ce9b3ae50>), 
('conv2/3x3', <caffe._caffe.BlobVec object at 0x7f7ce9b5ba60>), 
('inception_3a/1x1', <caffe._caffe.BlobVec object at 0x7f7ce9b5bb40>), 
('inception_3a/3x3_reduce', <caffe._caffe.BlobVec object at 0x7f7ce9b5bad0>), 
('inception_3a/3x3', <caffe._caffe.BlobVec object at 0x7f7ce9b5bbb0>), 
('inception_3a/5x5_reduce', <caffe._caffe.BlobVec object at 0x7f7ce9b5bc20>), 
('inception_3a/5x5', <caffe._caffe.BlobVec object at 0x7f7ce9b5bc90>), 
('inception_3a/pool_proj', <caffe._caffe.BlobVec object at 0x7f7ce9b5bd00>), ('inception_3b/1x1', <caffe._caffe.BlobVec object at 0x7f7ce9b5bd70>), ('inception_3b/3x3_reduce', <caffe._caffe.BlobVec object at 0x7f7ce9b5bde0>), ('inception_3b/3x3', <caffe._caffe.BlobVec object at 0x7f7ce9b5be50>), ('inception_3b/5x5_reduce', <caffe._caffe.BlobVec object at 0x7f7ce9b5bec0>), ('inception_3b/5x5', <caffe._caffe.BlobVec object at 0x7f7ce9b5bf30>), ('inception_3b/pool_proj', <caffe._caffe.BlobVec object at 0x7f7ce9b5bfa0>), ('inception_4a/1x1', <caffe._caffe.BlobVec object at 0x7f7ce9a7f050>), ('inception_4a/3x3_reduce', <caffe._caffe.BlobVec object at 0x7f7ce9a7f0c0>), ('inception_4a/3x3', <caffe._caffe.BlobVec object at 0x7f7ce9a7f130>), ('inception_4a/5x5_reduce', <caffe._caffe.BlobVec object at 0x7f7ce9a7f1a0>), ('inception_4a/5x5', <caffe._caffe.BlobVec object at 0x7f7ce9a7f210>), ('inception_4a/pool_proj', <caffe._caffe.BlobVec object at 0x7f7ce9a7f280>), ('inception_4b/1x1', <caffe._caffe.BlobVec object at 0x7f7ce9a7f2f0>), ('inception_4b/3x3_reduce', <caffe._caffe.BlobVec object at 0x7f7ce9a7f360>), ('inception_4b/3x3', <caffe._caffe.BlobVec object at 0x7f7ce9a7f3d0>), ('inception_4b/5x5_reduce', <caffe._caffe.BlobVec object at 0x7f7ce9a7f440>), ('inception_4b/5x5', <caffe._caffe.BlobVec object at 0x7f7ce9a7f4b0>), ('inception_4b/pool_proj', <caffe._caffe.BlobVec object at 0x7f7ce9a7f520>), ('inception_4c/1x1', <caffe._caffe.BlobVec object at 0x7f7ce9a7f590>), ('inception_4c/3x3_reduce', <caffe._caffe.BlobVec object at 0x7f7ce9a7f600>), ('inception_4c/3x3', <caffe._caffe.BlobVec object at 0x7f7ce9a7f670>), ('inception_4c/5x5_reduce', <caffe._caffe.BlobVec object at 0x7f7ce9a7f6e0>), ('inception_4c/5x5', <caffe._caffe.BlobVec object at 0x7f7ce9a7f750>), ('inception_4c/pool_proj', <caffe._caffe.BlobVec object at 0x7f7ce9a7f7c0>), ('inception_4d/1x1', <caffe._caffe.BlobVec object at 0x7f7ce9a7f830>), ('inception_4d/3x3_reduce', <caffe._caffe.BlobVec object at 0x7f7ce9a7f8a0>), ('inception_4d/3x3', <caffe._caffe.BlobVec object at 0x7f7ce9a7f910>), ('inception_4d/5x5_reduce', <caffe._caffe.BlobVec object at 0x7f7ce9a7f980>), ('inception_4d/5x5', <caffe._caffe.BlobVec object at 0x7f7ce9a7f9f0>), ('inception_4d/pool_proj', <caffe._caffe.BlobVec object at 0x7f7ce9a7fa60>), ('inception_4e/1x1', <caffe._caffe.BlobVec object at 0x7f7ce9a7fad0>), ('inception_4e/3x3_reduce', <caffe._caffe.BlobVec object at 0x7f7ce9a7fb40>), ('inception_4e/3x3', <caffe._caffe.BlobVec object at 0x7f7ce9a7fbb0>), ('inception_4e/5x5_reduce', <caffe._caffe.BlobVec object at 0x7f7ce9a7fc20>), ('inception_4e/5x5', <caffe._caffe.BlobVec object at 0x7f7ce9a7fc90>), ('inception_4e/pool_proj', <caffe._caffe.BlobVec object at 0x7f7ce9a7fd00>), ('inception_5a/1x1', <caffe._caffe.BlobVec object at 0x7f7ce9a7fd70>), ('inception_5a/3x3_reduce', <caffe._caffe.BlobVec object at 0x7f7ce9a7fde0>), ('inception_5a/3x3', <caffe._caffe.BlobVec object at 0x7f7ce9a7fe50>), ('inception_5a/5x5_reduce', <caffe._caffe.BlobVec object at 0x7f7ce9a7fec0>), ('inception_5a/5x5', <caffe._caffe.BlobVec object at 0x7f7ce9a7ff30>), ('inception_5a/pool_proj', <caffe._caffe.BlobVec object at 0x7f7ce9a7ffa0>), ('inception_5b/1x1', <caffe._caffe.BlobVec object at 0x7f7ce9a81050>), ('inception_5b/3x3_reduce', <caffe._caffe.BlobVec object at 0x7f7ce9a810c0>), ('inception_5b/3x3', <caffe._caffe.BlobVec object at 0x7f7ce9a81130>), ('inception_5b/5x5_reduce', <caffe._caffe.BlobVec object at 0x7f7ce9a811a0>), ('inception_5b/5x5', <caffe._caffe.BlobVec object at 0x7f7ce9a81210>), ('inception_5b/pool_proj', <caffe._caffe.BlobVec object at 0x7f7ce9a81280>), ('loss3/classifier_changed', <caffe._caffe.BlobVec object at 0x7f7ce9a812f0>)])

Do you know how to access the real numbers for these weights? They are just C++ objects right now.
Reply all
Reply to author
Forward
0 new messages