HyeonwooNoh / DeconvNet

DeconvNet : Learning Deconvolution Network for Semantic Segmentation
Other
325 stars 151 forks source link

Using results of stage1 directly #5

Open jeremy-rutman opened 8 years ago

jeremy-rutman commented 8 years ago

Hi , Thanks for releasing your excellent work. I would like to directly use the results of stage 1 training, without the further stages. I attempted to get the output using the following

    prototxt  = 'DeconvNet_inference_deploy.prototxt'
    caffemodel = 'snapshot/stage_1_train_iter_6000.caffemodel'
    net = caffe.Net(prototxt,caffemodel)
    im = Image.open(imagename)
    im = im.resize(dims,Image.ANTIALIAS)
    in_ = np.array(im, dtype=np.float32)
    in_ = in_[:,:,::-1]
    in_ -= np.array((104.0,116.7,122.7))
    in_ = in_.transpose((2,0,1))
    net.blobs['data'].reshape(1, *in_.shape)
    net.blobs['data'].data[...] = in_
    # run net and take argmax for prediction
    net.forward()
    out = net.blobs['seg-score'].data[0].argmax(axis=0)
   result = Image.fromarray(out.astype(np.uint8))
    result.save(outname)

but so far get only images with all pixels = 0 Is there something else I need to do ? This script, with minor changes, works for the fcn segmentations

tron19920125 commented 8 years ago

I have the same problem with you.Have you solve it yet?