Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using results of stage1 directly #5

Open
jeremy-rutman opened this issue May 29, 2016 · 1 comment
Open

Using results of stage1 directly #5

jeremy-rutman opened this issue May 29, 2016 · 1 comment

Comments

@jeremy-rutman
Copy link

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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants