Reputation: 1086
I have a pre-trained faster-rcnn caffemodel. I'm able to get the weights of the model using net.params[pr][0].data
. As of now the weights are of numpy float32 type. I would like to reduce it to float 16 just to reduce the size of the model.
Upvotes: 3
Views: 1103
Reputation: 5522
To change the type of the weights in order to save memory for the storage, you can use NumPy's astype(float16), for example
net.params[pr][0].data = net.params[pr][0].data.astype(numpy.float16)
However Caffe won't support it at inference / training time so you'll need to reconvert it to float32. However there are some caffe repositories that support float16, such as Ristretto, or NVCaffe for NVidia / Intel's clCaffe for OpenCL on Intel GPUs.
Upvotes: 1