caffe 训练 分类网络

阿里云双11来了!从本博客参与阿里云,服务器最低只要86元/年!

参考链接:https://blog.csdn.net/zhichaoduan/article/details/79663743
1.csv文件转txt 根据图片的标签分类

import pandas as pd 
import os 
 
file_path = "/media/veronica/D/X/Data.csv" 
file = pd.read_csv(file_path) 
 
labels = ["No Finding","Infiltration","Atelectasis","Effusion","Nodule","Pneumothorax","Mass","Consolidation","Pleural_Thickening", 
          "Cardiomegaly","Emphysema","Fibrosis","Edema","Pneumonia","Hernia"] 
index = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14] 
transfor = dict(zip(labels,index)) 
length = len(file["ImageIndex"]) 
 
with open("labels.txt","w") as f: 
    for i in range(0, length): 
        f.write("/media/veronica/"+file["ImageIndex"][i] + " " + str(transfor[file["FindingLabels"][i]]) + '\n') 
        print("Written %d already , total %d "%(i+1,length)) 
 
print("Mission complete")

2.生成分类lmdb文件
/home/hunter/caffe-master/build/tools/convert_imageset –resize_width=227 –resize_height=227 –shuffle /media/hunter/OS/X/image/ /media/hunter/OS/Users/Hunter/PycharmProjects/Intel/labels.txt /home/hunter/X/train_lmdb

2.生成mean.binaryproto均值文件 (在训练的时候可以注释,有一定影响)
sudo /home/hunter/caffe-master/build/tools/compute_image_mean /home/hunter/X/train_lmdb /home/hunter/X/mean.binaryproto

https://www.jianshu.com/p/2ac5f97c5f7d

Python量化投资网携手4326手游为资深游戏玩家推荐:《小冰冰传奇下载

「点点赞赏,手留余香」

    还没有人赞赏,快来当第一个赞赏的人吧!
0 条回复 A 作者 M 管理员
    所有的伟大,都源于一个勇敢的开始!
欢迎您,新朋友,感谢参与互动!欢迎您 {{author}},您在本站有{{commentsCount}}条评论