posenet_utils.py 文件源码

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

项目:pybot 作者: spillai 项目源码 文件源码
def __init__(self, model_file, weights_file, mean_file): 
        if not os.path.exists(model_file) or \
           not os.path.exists(weights_file) or \
           not os.path.exists(mean_file): 
            raise ValueError('Invalid model: {}, \nweights file: {}, \nmean file: {}'
                             .format(model_file, weights_file, mean_file))

        # Init caffe with model
        self.net_ = caffe.Net(model_file, weights_file, caffe.TEST)
        self.mean_file_ = mean_file
        self.input_shape_ = self.net_.blobs['data'].data.shape    

        # Initialize mean file
        blob_meanfile = caffe.proto.caffe_pb2.BlobProto()
        data_meanfile = open(mean_file , 'rb' ).read()
        blob_meanfile.ParseFromString(data_meanfile)
        meanfile = np.squeeze(np.array(caffe.io.blobproto_to_array(blob_meanfile)))
        self.meanfile_ = meanfile.transpose((1,2,0))
        self.meanfile_image_ = None
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号