推荐安装ubuntu18.04,安装NVIDIA显卡驱动不需要关闭图形窗口,接着安装cuda,cudnn,cuda可以直接命令行搞定。安装anaconda最新版是python3.7环境,需要在navigator中配置3.6环境。然后命令行安装caffe-cuda,opencv可以在anaconda中安装。我用硬盘拷了imagenet的lmdb数据,这种数据用普通数据库软件打不开,我用了以下代码,将数据解析出来,保存在电脑硬盘上。
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
imagenet2012 labelmap
"""
import os
import caffe
import lmdb
import numpy as np
from caffe.proto import caffe_pb2
import cv2ss='''n01440764,丁鲷
n01443537,金鱼
n01484850,大白鲨
n01491361,虎鲨
n01494475,锤头鲨
n01496331,电鳐
n01498041,黄貂鱼
n01514668,公鸡
n01514859,母鸡
n01518878,鸵鸟
n01530575,燕雀
n01531178,金翅雀
n01532829,家朱雀
n01534433,灯芯草雀
n01537544,靛蓝雀,靛蓝鸟
n01558993,蓝鹀
n01560419,夜莺
n01580077,松鸦
n01582220,喜鹊
n01592084,山雀
n01601694,河鸟
n01608432,鸢(猛禽)
n01614925,秃头鹰
n01616318,秃鹫
n01622779,大灰猫头鹰
n01629819,欧洲火蝾螈
n01630670,普通蝾螈
n01631663,水蜥
n01632458,斑点蝾螈
n01632777,蝾螈,泥狗
n01641577,牛蛙
n01644373,树蛙
n01644900,尾蛙,铃蟾蜍,肋蟾蜍,尾蟾蜍
n01664065,红海龟
n01665541,皮革龟
n01667114,泥龟
n01667778,淡水龟
n01669191,箱龟
n01675722,带状壁虎
n01677366,普通鬣蜥
n01682714,美国变色龙
n01685808,鞭尾蜥蜴
n01687978,飞龙科蜥蜴
n01688243,褶边蜥蜴
n01689811,鳄鱼蜥蜴
n01692333,毒蜥
n01693334,绿蜥蜴
n01694178,非洲变色龙
n01695060,科莫多蜥蜴
n01697457,非洲鳄,尼罗河鳄鱼
n01698640,美国鳄鱼,鳄鱼
n01704323,三角龙
n01728572,雷蛇,蠕虫蛇
n01728920,环蛇,环颈蛇
n01729322,希腊蛇
n01729977,绿蛇,草蛇
n01734418,国王蛇
n01735189,袜带蛇,草蛇
n01737021,水蛇
n01739381,藤蛇
n01740131,夜蛇
n01742172,大蟒蛇
n01744401,岩石蟒蛇,岩蛇,蟒蛇
n01748264,印度眼镜蛇
n01749939,绿曼巴
n01751748,海蛇
n01753488,角腹蛇
n01755581,菱纹响尾蛇
n01756291,角响尾蛇
n01768244,三叶虫
n01770081,盲蜘蛛
n01770393,蝎子
n01773157,黑金花园蜘蛛
n01773549,谷仓蜘蛛
n01773797,花园蜘蛛
n01774384,黑寡妇蜘蛛
n01774750,狼蛛
n01775062,狼蜘蛛,狩猎蜘蛛
n01776313,壁虱
n01784675,蜈蚣
n01795545,黑松鸡
n01796340,松鸡,雷鸟
n01797886,披肩鸡,披肩榛鸡
n01798484,草原鸡,草原松鸡
n01806143,孔雀
n01806567,鹌鹑
n01807496,鹧鸪
n01817953,非洲灰鹦鹉
n01818515,金刚鹦鹉
n01819313,硫冠鹦鹉
n01820546,短尾鹦鹉
n01824575,褐翅鸦鹃
n01828970,蜜蜂1
n01829413,犀鸟1
n01833805,蜂鸟
n01843065,鹟䴕
n01843383,犀鸟2
n01847000,野鸭
n01855032,红胸秋沙鸭
n01855672,鹅
n01860187,黑天鹅
n01871265,大象
n01872401,针鼹鼠
n01873310,鸭嘴兽
n01877812,沙袋鼠
n01882714,考拉,考拉熊
n01883070,袋熊
n01910747,水母
n01914609,海葵
n01917289,脑珊瑚
n01924916,扁形虫扁虫
n01930112,线虫,蛔虫
n01943899,海螺
n01944390,蜗牛
n01945685,鼻涕虫
n01950731,海参
n01955084,石鳖
n01968897,鹦鹉螺
n01978287,珍宝蟹
n01978455,石蟹
n01980166,招潮蟹
n01981276,帝王蟹,阿拉斯加蟹,阿拉斯加帝王蟹
n01983481,美国龙虾,缅因州龙虾
n01984695,大螯虾
n01985128,小龙虾
n01986214,寄居蟹
n01990800,等足目动物(明虾和螃蟹近亲)
n02002556,白鹳
n02002724,黑鹳
n02006656,鹭
n02007558,火烈鸟
n02009229,小蓝鹭
n02009912,美国鹭,大白鹭
n02011460,麻鸦
n02012849,鹤
n02013706,秧鹤
n02017213,欧洲水鸡,紫水鸡
n02018207,沼泽泥母鸡,水母鸡
n02018795,鸨
n02025239,红翻石鹬
n02027492,红背鹬,黑腹滨鹬
n02028035,红脚鹬
n02033041,半蹼鹬
n02037110,蛎鹬
n02051845,鹈鹕
n02056570,国王企鹅
n02058221,信天翁,大海鸟
n02066245,灰鲸
n02071294,杀人鲸,逆戟鲸,虎鲸
n02074367,海牛
n02077923,海狮
n02085620,奇瓦瓦
n02085782,日本猎犬
n02085936,马尔济斯犬
n02086079,狮子狗
n02086240,西施犬
n02086646,布莱尼姆猎犬
n02086910,巴比狗
n02087046,玩具犬
n02087394,罗得西亚长背猎狗
n02088094,阿富汗猎犬
n02088238,猎犬
n02088364,比格犬,猎兔犬
n02088466,侦探犬
n02088632,蓝色快狗
n02089078,黑褐猎浣熊犬
n02089867,沃克猎犬
n02089973,英国猎狐犬
n02090379,美洲赤狗
n02090622,俄罗斯猎狼犬
n02090721,爱尔兰猎狼犬
n02091032,意大利灰狗
n02091134,惠比特犬
n02091244,依比沙猎犬
n02091467,挪威猎犬
n02091635,奥达猎犬,水獭猎犬
n02091831,沙克犬,瞪羚猎犬
n02092002,苏格兰猎鹿犬,猎鹿犬
n02092339,威玛猎犬
n02093256,斯塔福德郡牛头梗,斯塔福德郡斗牛梗
n02093428,美国斯塔福德郡梗,美国比特斗牛梗,斗牛梗
n02093647,贝德灵顿梗
n02093754,边境梗
n02093859,凯丽蓝梗
n02093991,爱尔兰梗
n02094114,诺福克梗
n02094258,诺维奇梗
n02094433,约克郡梗
n02095314,刚毛猎狐梗
n02095570,莱克兰梗
n02095889,锡利哈姆梗
n02096051,艾尔谷犬
n02096177,凯恩梗
n02096294,澳大利亚梗
n02096437,丹迪丁蒙梗
n02096585,波士顿梗
n02097047,迷你雪纳瑞犬
n02097130,巨型雪纳瑞犬
n02097209,标准雪纳瑞犬
n02097298,苏格兰梗
n02097474,西藏梗,菊花狗
n02097658,丝毛梗
n02098105,软毛麦色梗
n02098286,西高地白梗
n02098413,拉萨阿普索犬
n02099267,平毛寻回犬
n02099429,卷毛寻回犬
n02099601,金毛猎犬
n02099712,拉布拉多猎犬
n02099849,乞沙比克猎犬
n02100236,德国短毛猎犬
n02100583,维兹拉犬
n02100735,英国谍犬
n02100877,爱尔兰雪达犬,红色猎犬
n02101006,戈登雪达犬
n02101388,布列塔尼犬猎犬
n02101556,黄毛,黄毛猎犬
n02102040,英国史宾格犬
n02102177,威尔士史宾格犬
n02102318,可卡犬,英国可卡犬
n02102480,萨塞克斯猎犬
n02102973,爱尔兰水猎犬
n02104029,哥威斯犬
n02104365,舒柏奇犬
n02105056,比利时牧羊犬
n02105162,马里努阿犬
n02105251,伯瑞犬
n02105412,凯尔皮犬
n02105505,匈牙利牧羊犬
n02105641,老英国牧羊犬
n02105855,喜乐蒂牧羊犬
n02106030,牧羊犬
n02106166,边境牧羊犬
n02106382,法兰德斯牧牛狗
n02106550,罗特韦尔犬
n02106662,德国牧羊犬,德国警犬,阿尔萨斯
n02107142,多伯曼犬,杜宾犬
n02107312,迷你杜宾犬
n02107574,大瑞士山地犬
n02107683,伯恩山犬
n02107908,Appenzeller狗
n02108000,EntleBucher狗
n02108089,拳师狗
n02108422,斗牛獒
n02108551,藏獒
n02108915,法国斗牛犬
n02109047,大丹犬
n02109525,圣伯纳德狗
n02109961,爱斯基摩犬,哈士奇
n02110063,雪橇犬,阿拉斯加爱斯基摩狗
n02110185,哈士奇
n02110341,达尔马提亚,教练车狗
n02110627,狮毛狗
n02110806,巴辛吉狗
n02110958,哈巴狗,狮子狗
n02111129,莱昂贝格狗
n02111277,纽芬兰岛狗
n02111500,大白熊犬
n02111889,萨摩耶犬
n02112018,博美犬
n02112137,松狮,松狮
n02112350,荷兰卷尾狮毛狗
n02112706,布鲁塞尔格林芬犬
n02113023,彭布洛克威尔士科基犬
n02113186,威尔士柯基犬
n02113624,玩具贵宾犬
n02113712,迷你贵宾犬
n02113799,标准贵宾犬
n02113978,墨西哥无毛犬
n02114367,灰狼
n02114548,白狼,北极狼
n02114712,红太狼,鬃狼,犬犬鲁弗斯
n02114855,狼,草原狼,刷狼,郊狼
n02115641,澳洲野狗,澳大利亚野犬
n02115913,豺
n02116738,非洲猎犬,土狼犬
n02117135,鬣狗
n02119022,红狐狸
n02119789,沙狐
n02120079,北极狐狸,白狐狸
n02120505,灰狐狸
n02123045,虎斑猫
n02123159,山猫,虎猫
n02123394,波斯猫
n02123597,暹罗暹罗猫,
n02124075,埃及猫
n02125311,美洲狮,美洲豹
n02127052,猞猁,山猫
n02128385,豹子
n02128757,雪豹
n02128925,美洲虎
n02129165,狮子
n02129604,老虎
n02130308,猎豹
n02132136,棕熊
n02133161,美洲黑熊
n02134084,冰熊,北极熊
n02134418,懒熊
n02137549,猫鼬
n02138441,猫鼬,海猫
n02165105,虎甲虫
n02165456,瓢虫
n02167151,土鳖虫
n02168699,天牛
n02169497,龟甲虫
n02172182,粪甲虫
n02174001,犀牛甲虫
n02177972,象甲
n02190166,苍蝇
n02206856,蜜蜂2
n02219486,蚂蚁
n02226429,蚱蜢
n02229544,蟋蟀
n02231487,竹节虫
n02233338,蟑螂
n02236044,螳螂
n02256656,蝉
n02259212,叶蝉
n02264363,草蜻蛉
n02268443,蜻蜓
n02268853,豆娘,蜻蛉
n02276258,优红蛱蝶
n02277742,小环蝴蝶
n02279972,君主蝴蝶,大斑蝶
n02280649,菜粉蝶
n02281406,白蝴蝶
n02281787,灰蝶
n02317335,海星
n02319095,海胆
n02321529,海参,海黄瓜
n02325366,野兔
n02326432,兔
n02328150,安哥拉兔
n02342885,仓鼠
n02346627,刺猬,豪猪,
n02356798,黑松鼠
n02361337,土拨鼠
n02363005,海狸
n02364673,豚鼠,豚鼠
n02389026,栗色马
n02391049,斑马
n02395406,猪
n02396427,野猪
n02397096,疣猪
n02398521,河马
n02403003,牛
n02408429,水牛,亚洲水牛
n02410509,野牛
n02412080,公羊
n02415577,大角羊,洛矶山大角羊
n02417914,山羊
n02422106,狷羚
n02422699,黑斑羚
n02423022,瞪羚
n02437312,阿拉伯单峰骆驼,骆驼
n02437616,骆驼
n02441942,黄鼠狼
n02442845,水貂
n02443114,臭猫
n02443484,黑足鼬
n02444819,水獭
n02445715,臭鼬,木猫
n02447366,獾
n02454379,犰狳
n02457408,树懒
n02480495,猩猩,婆罗洲猩猩
n02480855,大猩猩
n02481823,黑猩猩
n02483362,长臂猿
n02483708,合趾猿长臂猿,合趾猿
n02484975,长尾猴
n02486261,赤猴
n02486410,狒狒
n02487347,恒河猴,猕猴
n02488291,白头叶猴
n02488702,疣猴
n02489166,长鼻猴
n02490219,狨(美洲产小型长尾猴)
n02492035,卷尾猴
n02492660,吼猴
n02493509,伶猴
n02493793,蜘蛛猴
n02494079,松鼠猴
n02497673,马达加斯加环尾狐猴,鼠狐猴
n02500267,大狐猴,马达加斯加大狐猴
n02504013,印度大象,亚洲象
n02504458,非洲象,非洲象
n02509815,小熊猫
n02510455,大熊猫
n02514041,杖鱼
n02526121,鳗鱼
n02536864,银鲑,银鲑鱼
n02606052,三色刺蝶鱼
n02607072,海葵鱼
n02640242,鲟鱼
n02641379,雀鳝
n02643566,狮子鱼
n02655020,河豚
n02666196,算盘
n02667093,长袍
n02669723,学位袍
n02672831,手风琴
n02676566,原声吉他
n02687172,航空母舰
n02690373,客机
n02692877,飞艇
n02699494,祭坛
n02701002,救护车
n02704792,水陆两用车
n02708093,模拟时钟
n02727426,蜂房
n02730930,围裙
n02747177,垃圾桶
n02749479,攻击步枪,枪
n02769748,背包
n02776631,面包店,面包铺,
n02777292,平衡木
n02782093,热气球
n02783161,圆珠笔
n02786058,创可贴
n02787622,班卓琴
n02788148,栏杆,楼梯扶手
n02790996,杠铃
n02791124,理发师的椅子
n02791270,理发店
n02793495,牲口棚
n02794156,晴雨表
n02795169,圆筒
n02797295,园地小车,手推车
n02799071,棒球
n02802426,篮球
n02804414,婴儿床
n02804610,巴松管,低音管
n02807133,游泳帽
n02808304,沐浴毛巾
n02808440,浴缸,澡盆
n02814533,沙滩车,旅行车
n02814860,灯塔
n02815834,高脚杯1
n02817516,熊皮高帽
n02823428,啤酒瓶
n02823750,啤酒杯
n02825657,钟塔
n02834397,(小儿用的)围嘴
n02835271,串联自行车,
n02837789,比基尼
n02840245,装订册
n02841315,双筒望远镜
n02843684,鸟舍
n02859443,船库
n02860847,雪橇1
n02865351,饰扣式领带
n02869837,阔边女帽
n02870880,书橱
n02871525,书店,书摊
n02877765,瓶盖
n02879718,弓箭
n02883205,蝴蝶结领结
n02892201,铜制牌位
n02892767,奶罩
n02894605,防波堤,海堤
n02895154,铠甲
n02906734,扫帚
n02909870,桶
n02910353,扣环
n02916936,防弹背心
n02917067,动车,子弹头列车
n02927161,肉铺,肉菜市场
n02930766,出租车
n02939185,大锅
n02948072,蜡烛
n02950826,大炮
n02951358,独木舟
n02951585,开瓶器,开罐器
n02963159,开衫
n02965783,车镜
n02966193,旋转木马
n02966687,木匠的工具包,工具包
n02971356,纸箱
n02974003,车轮
n02977058,取款机,自动取款机
n02978881,盒式录音带
n02979186,卡带播放器
n02980441,城堡
n02981792,双体船
n02988304,CD播放器
n02992211,大提琴
n02992529,移动电话,手机
n02999410,铁链
n03000134,围栏
n03000247,链甲
n03000684,电锯,油锯
n03014705,箱子
n03016953,衣柜,洗脸台
n03017168,编钟,钟,锣
n03018349,中国橱柜
n03026506,圣诞袜
n03028079,教堂,教堂建筑
n03032252,电影院,剧场
n03041632,切肉刀,菜刀
n03042490,悬崖屋
n03045698,斗篷
n03047690,木屐,木鞋
n03062245,鸡尾酒调酒器
n03063599,咖啡杯
n03063689,咖啡壶
n03065424,螺旋结构(楼梯)
n03075370,组合锁
n03085013,电脑键盘,键盘
n03089624,糖果,糖果店
n03095699,集装箱船
n03100240,敞篷车
n03109150,开瓶器,瓶螺杆
n03110669,短号,喇叭
n03124043,牛仔靴
n03124170,牛仔帽
n03125729,摇篮
n03126707,起重机
n03127747,头盔
n03127925,板条箱
n03131574,小儿床
n03133878,砂锅
n03134739,槌球
n03141823,拐杖
n03146219,胸甲
n03160309,大坝,堤防
n03179701,书桌
n03180011,台式电脑
n03187595,有线电话
n03188531,尿布湿
n03196217,数字时钟
n03197337,数字手表
n03201208,餐桌板
n03207743,抹布
n03207941,洗碗机,洗碟机
n03208938,盘式制动器
n03216828,码头,船坞,码头设施
n03218198,狗拉雪橇
n03220513,圆顶
n03223299,门垫,垫子
n03240683,钻井平台,海上钻井
n03249569,鼓,乐器,鼓膜
n03250847,鼓槌
n03255030,哑铃
n03259280,荷兰烤箱
n03271574,电风扇,鼓风机
n03272010,电吉他
n03272562,电力机车
n03290653,电视,电视柜
n03291819,信封
n03297495,浓缩咖啡机
n03314780,扑面粉
n03325584,女用长围巾
n03337140,文件,文件柜,档案柜
n03344393,消防船
n03345487,消防车
n03347037,火炉栏
n03355925,旗杆
n03372029,长笛
n03376595,折叠椅
n03379051,橄榄球头盔
n03384352,叉车
n03388043,喷泉
n03388183,钢笔
n03388549,有四根帷柱的床
n03393912,运货车厢
n03394916,圆号,喇叭
n03400231,煎锅
n03404251,裘皮大衣
n03417042,垃圾车
n03424325,防毒面具,呼吸器
n03425413,汽油泵
n03443371,高脚杯2
n03444034,卡丁车
n03445777,高尔夫球
n03445924,高尔夫球车
n03447447,狭长小船
n03447721,锣
n03450230,礼服
n03452741,钢琴
n03457902,温室,苗圃
n03459775,散热器格栅
n03461385,杂货店,食品市场
n03467068,断头台
n03476684,小发夹
n03476991,头发喷雾
n03478589,半履带装甲车
n03481172,锤子
n03482405,大篮子
n03483316,手摇鼓风机,吹风机
n03485407,手提电脑
n03485794,手帕
n03492542,硬盘
n03494278,口琴,口风琴
n03495258,竖琴
n03496892,收割机
n03498962,斧头
n03527444,手枪皮套
n03529860,家庭影院
n03530642,蜂窝
n03532672,钩爪
n03534580,衬裙
n03535780,单杠
n03538406,马车
n03544143,沙漏
n03584254,iPod
n03584829,熨斗
n03590841,南瓜灯笼
n03594734,牛仔裤,蓝色牛仔裤
n03594945,吉普车
n03595614,运动衫,T恤
n03598930,拼图
n03599486,人力车
n03602883,操纵杆
n03617480,和服
n03623198,护膝
n03627232,蝴蝶结
n03630383,大褂,实验室外套
n03633091,长柄勺
n03637318,灯罩
n03642806,笔记本电脑
n03649909,割草机
n03657121,镜头盖
n03658185,开信刀,裁纸刀
n03661043,图书馆
n03662601,救生艇
n03666591,点火器,打火机
n03670208,豪华轿车
n03673027,远洋班轮
n03676483,唇膏,口红
n03680355,平底便鞋
n03690938,洗剂
n03691459,扬声器
n03692522,放大镜
n03697007,锯木厂
n03706229,磁罗盘
n03709823,邮袋
n03710193,信箱
n03710637,女游泳衣
n03710721,有肩带浴衣
n03717622,窨井盖
n03720891,沙球(一种打击乐器)
n03721384,马林巴木琴
n03724870,面膜
n03729826,火柴
n03733131,花柱
n03733281,迷宫
n03733805,量杯
n03742115,药箱
n03743016,巨石,巨石结构
n03759954,麦克风
n03761084,微波炉
n03763968,军装
n03764736,奶桶
n03769881,迷你巴士
n03770439,迷你裙
n03770679,面包车
n03773504,导弹
n03775071,连指手套
n03775546,搅拌钵
n03776460,活动房屋(由汽车拖拉的)
n03777568,T型发动机小汽车
n03777754,调制解调器
n03781244,修道院
n03782006,显示器
n03785016,电瓶车
n03786901,砂浆
n03787032,学士
n03788195,清真寺
n03788365,蚊帐
n03791053,摩托车
n03792782,山地自行车
n03792972,登山帐
n03793489,鼠标,电脑鼠标
n03794056,捕鼠器
n03796401,搬家车
n03803284,口套
n03804744,钉子
n03814639,颈托
n03814906,项链
n03825788,乳头(瓶)
n03832673,笔记本,笔记本电脑
n03837869,方尖碑
n03838899,双簧管
n03840681,陶笛,卵形笛
n03841143,里程表
n03843555,滤油器
n03854065,风琴,管风琴
n03857828,示波器
n03866082,罩裙
n03868242,牛车
n03868863,氧气面罩
n03871628,包装
n03873416,船桨
n03874293,明轮,桨轮
n03874599,挂锁,扣锁
n03876231,画笔
n03877472,睡衣
n03877845,宫殿
n03884397,排箫,鸣管
n03887697,纸巾
n03888257,降落伞
n03888605,双杠
n03891251,公园长椅
n03891332,停车收费表,停车计时器
n03895866,客车,教练车
n03899768,露台,阳台
n03902125,付费电话
n03903868,基座,基脚
n03908618,铅笔盒
n03908714,卷笔刀
n03916031,香水(瓶)
n03920288,培养皿
n03924679,复印机
n03929660,拨弦片,拨子
n03929855,尖顶头盔
n03930313,栅栏,栅栏
n03930630,皮卡,皮卡车
n03933933,桥墩
n03935335,存钱罐
n03937543,药瓶
n03938244,枕头
n03942813,乒乓球
n03944341,风车
n03947888,海盗船
n03950228,水罐
n03954731,木工刨
n03956157,天文馆
n03958227,塑料袋
n03961711,板架
n03967562,犁型铲雪机
n03970156,手压皮碗泵
n03976467,宝丽来相机
n03976657,电线杆
n03977966,警车,巡逻车
n03980874,雨披
n03982430,台球桌
n03983396,充气饮料瓶
n03991062,花盆
n03992509,陶工旋盘
n03995372,电钻
n03998194,祈祷垫,地毯
n04004767,打印机
n04005630,监狱
n04008634,炮弹,导弹
n04009552,投影仪
n04019541,冰球
n04023962,沙包,吊球
n04026417,钱包
n04033901,羽管笔
n04033995,被子
n04037443,赛车
n04039381,球拍
n04040759,散热器
n04041544,收音机
n04044716,射电望远镜,无线电反射器
n04049303,雨桶
n04065272,休闲车,房车
n04067472,卷轴,卷筒
n04069434,反射式照相机
n04070727,冰箱,冰柜
n04074963,遥控器
n04081281,餐厅,饮食店,食堂
n04086273,左轮手枪
n04090263,步枪
n04099969,摇椅
n04111531,电转烤肉架
n04116512,橡皮
n04118538,橄榄球
n04118776,直尺
n04120489,跑步鞋
n04125021,保险柜
n04127249,安全别针
n04131690,盐瓶(调味用)
n04133789,凉鞋
n04136333,纱笼,围裙
n04141076,萨克斯管
n04141327,剑鞘
n04141975,秤,称重机
n04146614,校车
n04147183,帆船
n04149813,记分牌
n04152593,屏幕
n04153751,螺丝
n04154565,螺丝刀
n04162706,安全带
n04179913,缝纫机
n04192698,盾牌,盾牌
n04200800,皮鞋店,鞋店
n04201297,障子
n04204238,购物篮
n04204347,购物车
n04208210,铁锹
n04209133,浴帽
n04209239,浴帘
n04228054,滑雪板
n04229816,滑雪面罩
n04235860,睡袋
n04238763,滑尺
n04239074,滑动门
n04243546,角子老虎机
n04251144,潜水通气管
n04252077,雪橇2
n04252225,扫雪机,扫雪机
n04254120,皂液器
n04254680,足球
n04254777,袜子
n04258138,碟式太阳能,太阳能集热器,太阳能炉
n04259630,宽边帽
n04263257,汤碗
n04264628,空格键
n04265275,空间加热器
n04266014,航天飞机
n04270147,铲(搅拌或涂敷用的)
n04273569,快艇
n04275548,蜘蛛网
n04277352,纺锤,纱锭
n04285008,跑车
n04286575,聚光灯
n04296562,舞台
n04310018,蒸汽机车
n04311004,钢拱桥
n04311174,钢滚筒
n04317175,听诊器
n04325704,女用披肩
n04326547,石头墙
n04328186,秒表
n04330267,火炉
n04332243,过滤器
n04335435,有轨电车,电车
n04336792,担架
n04344873,沙发床
n04346328,佛塔
n04347754,潜艇,潜水艇
n04350905,套装,衣服
n04355338,日晷
n04355933,太阳镜
n04356056,太阳镜,墨镜
n04357314,防晒霜,防晒剂
n04366367,悬索桥
n04367480,拖把
n04370456,运动衫
n04371430,游泳裤
n04371774,秋千
n04372370,开关,电器开关
n04376876,注射器
n04380533,台灯
n04389033,坦克,装甲战车,装甲战斗车辆
n04392985,磁带播放器
n04398044,茶壶
n04399382,泰迪,泰迪熊
n04404412,电视
n04409515,网球
n04417672,茅草,茅草屋顶
n04418357,幕布,剧院的帷幕
n04423845,顶针
n04428191,脱粒机
n04429376,宝座
n04435653,瓦屋顶
n04442312,烤面包机
n04443257,烟草店,烟草
n04447861,马桶
n04456115,火炬
n04458633,图腾柱
n04461696,拖车,牵引车,清障车
n04462240,玩具店
n04465501,拖拉机
n04467665,拖车,铰接式卡车
n04476259,托盘
n04479046,风衣
n04482393,三轮车
n04483307,三体船
n04485082,三脚架
n04486054,凯旋门
n04487081,无轨电车
n04487394,长号
n04493381,浴盆,浴缸
n04501370,旋转式栅门
n04505470,打字机键盘
n04507155,伞
n04509417,独轮车
n04515003,直立式钢琴
n04517823,真空吸尘器
n04522168,花瓶
n04523525,拱顶
n04525038,天鹅绒
n04525305,自动售货机
n04532106,祭服
n04532670,高架桥
n04536866,小提琴,小提琴
n04540053,排球
n04542943,松饼机
n04548280,挂钟
n04548362,钱包,皮夹
n04550184,衣柜,壁橱
n04552348,军用飞机
n04553703,洗脸盆,洗手盆
n04554684,洗衣机,自动洗衣机
n04557648,水瓶
n04560804,水壶
n04562935,水塔
n04579145,威士忌壶
n04579432,哨子
n04584207,假发
n04589890,纱窗
n04590129,百叶窗
n04591157,温莎领带
n04591713,葡萄酒瓶
n04592741,飞机翅膀,飞机
n04596742,炒菜锅
n04597913,木制的勺子
n04599235,毛织品,羊绒
n04604644,栅栏,围栏
n04606251,沉船
n04612504,双桅船
n04613696,蒙古包
n06359193,网站,互联网网站
n06596364,漫画
n06785654,纵横字谜
n06794110,路标
n06874185,交通信号灯
n07248320,防尘罩,书皮
n07565083,菜单
n07579787,盘子
n07583066,鳄梨酱
n07584110,清汤
n07590611,罐焖土豆烧肉
n07613480,蛋糕
n07614500,冰淇淋
n07615774,雪糕,冰棍,冰棒
n07684084,法式面包
n07693725,百吉饼
n07695742,椒盐脆饼
n07697313,芝士汉堡
n07697537,热狗
n07711569,土豆泥
n07714571,结球甘蓝
n07714990,西兰花
n07715103,菜花
n07716358,绿皮密生西葫芦
n07716906,西葫芦
n07717410,小青南瓜
n07717556,南瓜
n07718472,黄瓜
n07718747,朝鲜蓟
n07720875,甜椒
n07730033,刺棘蓟
n07734744,蘑菇
n07742313,绿苹果
n07745940,草莓
n07747607,橘子
n07749582,柠檬
n07753113,无花果
n07753275,菠萝
n07753592,香蕉
n07754684,菠萝蜜
n07760859,蛋奶冻苹果
n07768694,石榴
n07802026,干草
n07831146,烤面条加干酪沙司
n07836838,巧克力酱,巧克力糖浆
n07860988,面团
n07871810,瑞士肉包,肉饼
n07873807,披萨,披萨饼
n07875152,馅饼
n07880968,卷饼
n07892512,红葡萄酒
n07920052,意大利浓咖啡
n07930864,杯子
n07932039,蛋酒
n09193705,高山
n09229709,泡泡
n09246464,悬崖
n09256479,珊瑚礁
n09288635,间歇泉
n09332890,湖边,湖岸
n09399592,海角
n09421951,沙洲,沙坝
n09428293,海滨,海岸
n09468604,峡谷
n09472597,火山
n09835506,棒球,棒球运动员
n10148035,新郎
n10565667,潜水员
n11879895,油菜
n11939491,雏菊
n12057211,杓兰
n12144580,玉米
n12267677,橡子
n12620546,玫瑰果
n12768682,七叶树果实
n12985857,珊瑚菌
n12998815,木耳
n13037406,鹿花菌
n13040303,鬼笔菌
n13044778,地星
n13052670,多叶奇果菌
n13054560,牛肝菌
n13133613,玉米穗
n15075141,卫生纸'''L=ss.split('\n')
Dmap=dict()
Lname=list()
for idx, d in enumerate(L):Dmap[idx]=''.join(d.split(',')[1:])Lname.append(''.join(d.split(',')[1:]))# datasets
dest='/home/weizhe/图片/imagenet2012/test'
for name in Lname:if not os.path.exists(os.path.join(dest,name)):os.makedirs(os.path.join(dest,name))else:print('%s exists!' % name)fpath='/media/weizhe/Hitachi/imagenet/ilsvrc12_val_lmdb'
lmdb_env = lmdb.open(fpath, readonly=True)
lmdb_txn = lmdb_env.begin()
lmdb_cursor = lmdb_txn.cursor()
datum = caffe_pb2.Datum()
nCount=0
for key, value in lmdb_cursor:datum.ParseFromString(value)label = datum.labeldata = caffe.io.datum_to_array(datum)#CxHxW to HxWxC in cv2image = np.transpose(data, (1,2,0))ext='%d.jpg' % nCountcv2.imwrite(os.path.join(dest,Dmap[label],ext),image)print(nCount)nCount+=1
暂时没找到windows下的解决办法,在此公开方法,避免大家走弯路。