alexgkendall / caffe-segnet

Implementation of SegNet: A Deep Convolutional Encoder-Decoder Architecture for Semantic Pixel-Wise Labelling
http://mi.eng.cam.ac.uk/projects/segnet/
Other
1.08k stars 452 forks source link

LMDB label loaded as float rather than uint8 #80

Open LuSMD opened 8 years ago

LuSMD commented 8 years ago

I have converted my label to LMDB:

map_size = Y.nbytes*10
env = lmdb.open(saveloc+'labels', map_size=map_size)
for z in N:
    i = N[z]
    im_dat = caffe.io.array_to_datum(np.array(Y[i]).astype(np.uint8))
    str_id = '{:0>10d}'.format(i)
    with env.begin(write=True) as txn:
        txn.put(str_id, im_dat.SerializeToString())

Defined them inside train.prototxt:

layer {
  name: "label"
  type: "Data"
  top: "label"
  data_param {
    source: savloc+"labels" 
    batch_size: 3   
    backend: LMDB
  }
}

But when I load the label in the net, the label is shown to be float32.

model='train.prototxt'
net = caffe.Net(model,caffe.TEST)
net.forward()
label=net.blobs['label'].data
label.dtype

displays: dtype('float32'). Anybody knows why? My segmentation result is not as good when I converted my jpg data and label to LMDB. Could it be because my label is loaded as float?

wenjiebit commented 7 years ago

I used the same method as you. And I also met this problem. I met an error : Check failed: status == CUBLAS_STATUS_SUCCESS (11 vs. 0) CUBLAS_STATUS_MAPPING_ERROR Have you solved your problem?