DeepDream.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:QScode 作者: PierreHao 项目源码 文件源码
def __init__(self):
        caffe.set_mode_gpu()
        #caffe.set_device(0)
        model_path = '../models/bvlc_googlenet/' # substitute your path here
        net_fn   = model_path + 'deploy.prototxt'
        param_fn = model_path + 'bvlc_googlenet.caffemodel'
        model = caffe.io.caffe_pb2.NetParameter()
        text_format.Merge(open(net_fn).read(), model)
        model.force_backward = True #backward to input layer
        open('tmp.prototxt', 'w').write(str(model))
        self.net = caffe.Classifier('tmp.prototxt', param_fn,
                       mean = np.float32([104.0, 116.0, 122.0]), 
                       channel_swap = (2,1,0))
        # for the mode guide, if flag = 1               
        self.flag = 0
        self.epoch = 20
        self.end = 'inception_4c/output'
        #self.end = 'conv4'
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号