Code Monkey home page Code Monkey logo

Comments (1)

seva100 avatar seva100 commented on June 25, 2024

@Mahanteshambi, big apologies for not noticing your request in time.
Actually you just needed to add one line which rescales an image from uint8 [0, 255] scale to float [0, 1] scale of intensities:

im = np.array(Image.open(img_path))
im = im[0:, 40:]
print(im.shape)
im = cv2.resize(im, (256,256))

im = im.astype(np.float64) / 255.0

print(im.shape)
plt.imshow(im), plt.show()
im = np.expand_dims(im, axis=0)
im = tf_to_th_encoding(im)
prediction = (model.predict(im)[0, 0]).astype(np.float64)
plt.imshow(prediction, cmap=plt.cm.Greys_r), plt.show()

This way it works fine for me.

Also, it's necessary to add CLAHE im = skimage.exposure.equalize_adapthist(im) right after the rescaling line im = im.astype(np.float64) / 255.0 in order to reproduce exactly the same results, since model expects images only after CLAHE was performed on them.

from optic-nerve-cnn.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.