mirror of https://github.com/JDAI-CV/fast-reid.git
Summary: update deployment README and support pytorch to caffe converting for basemodel |
||
---|---|---|
.. | ||
ReadMe.md | ||
__init__.py | ||
caffe.proto | ||
caffe_lmdb.py | ||
caffe_net.py | ||
caffe_pb2.py | ||
layer_param.py | ||
net.py |
ReadMe.md
The Caffe in PytorchToCaffe Provides some convenient API
If there are some problem in parse your prototxt or caffemodel, Please replace
the caffe.proto with your own version and compile it with command
protoc --python_out ./ caffe.proto
caffe_net.py
Using from nn_tools.Caffe import caffe_net
to import this model
Prototxt
net=caffe_net.Prototxt(file_name)
to open a prototxt filenet.init_caffemodel(caffe_cmd_path='caffe')
to generate a caffemodel file in the current work directory
if yourcaffe
cmd not in the $PATH, specify your caffe cmd path by thecaffe_cmd_path
kwargs.
Caffemodel
net=caffe_net.Caffemodel(file_name)
to open a caffemodelnet.save_prototxt(path)
to save the caffemodel to a prototxt file (not containing the weight data)net.get_layer_data(layer_name)
return the numpy ndarray data of the layernet.set_layer_date(layer_name, datas)
specify the data of one layer in the caffemodel .datas
is normally a list of numpy ndarray[weights,bias]
net.save(path)
save the changed caffemodel
Functions for both Prototxt and Caffemodel
net.add_layer(layer_params,before='',after='')
add a new layer withLayer_Param
objectnet.remove_layer_by_name(layer_name)
net.get_layer_by_name(layer_name)
ornet.layer(layer_name)
get the raw Layer object defined in caffe_pb2