Code Monkey home page Code Monkey logo

Comments (7)

TobyPDE avatar TobyPDE commented on August 22, 2024 1

Hey,

You can feed any image into the network as follows:

  • Load the image into an RGB numpy tensor
  • Rescale the intensity values to [0, 1]
  • Make sure that the channel ordering is RGB and not BGR (opencv standard)
  • Reshape and dimshuffle the tensor to [1, 3, H, W] where H and W are the image height (rows) and width (cols), respectively.
  • Feed the tensor into the network.

from frrn.

BBarbosa avatar BBarbosa commented on August 22, 2024 1

Hi @TobyPDE!
I tried to follow the steps you mentioned here but the predictions only get 2 classes (related with light pink and black colors).
segmentation

I also printed the outout prediction matrix and, from what I understood, it should paint the segmented image with another colors.

[[[2 2 2 ..., 3 2 3]
  [2 2 2 ..., 3 2 3]
  [2 2 2 ..., 3 3 3]
  ...,
  [9 9 9 ..., 0 0 0]
  [8 9 9 ..., 0 0 0]
  [0 0 9 ..., 0 0 0]]]

Edit

I made same changes at the create_color_label_image function on dltools/utility.py and it solved my problem.

With the best regards

from frrn.

daicoolb avatar daicoolb commented on August 22, 2024 1

@BBarbosa Hi, Can you show me your code here ?

from frrn.

daicoolb avatar daicoolb commented on August 22, 2024

@TobyPDE I have tried it . but it seems not work

from frrn.

BBarbosa avatar BBarbosa commented on August 22, 2024

Hi @daicoolb!
These are the files I have changed:

  • use mypredict.py instead of predict.py
  • replace the dltools/utility.py
  • replace train.py
  • replace dltools/architectures.py

I'm using OpenCV 3.3 because it gave me problems trying to load a video file with OpenCV 2.4.
Download files from here frrn.zip

from frrn.

hans41 avatar hans41 commented on August 22, 2024

@BBarbosa Thanks for your changes!
I have used your new scripts to predict my own data. The "predictions[0]" has now 3 dimensions instead of 2. For example:
(1, 800, 1280) vs (800, 1280)
Why is that?
And with the same input images, if using "mypredict.py" I got different results from what "predict.py" did. It seems the "image" you feed to "pred_fn(image)" is not the same "batch[0]" the author feeds to "val_fn(batch[0], batch[1])".

from frrn.

BBarbosa avatar BBarbosa commented on August 22, 2024

@hans41 you're welcome. I hope it helped in some useful way.
Technically, (1,800,1280) and (800,1280) are equivalent.
With regard to the inputs images, i had problems feeding images to the network with the author's provider implementation. So, I managed to adapt one for my own following what @TobyPDE described here . The outputs may differ from mypredict.py to predict.py once there may be some pre-processing operations skipped.
This in an example of what I got. It works really good even in an different angle from what it was trained for.
ped

from frrn.

Related Issues (20)

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.