Code Monkey home page Code Monkey logo

Comments (8)

windj007 avatar windj007 commented on August 24, 2024

Hi! Sorry for the late reply!

It is by design that the input dataloader reads images only with a single variant of extension (either .jpg or .png). There are no sparticular strong reasons for that - just because it is simple and has been enough for evaluation purposes.

You can change the line dataset.img_suffix=.jpg to the prediction command here so the dataloader reads JPGs

from lama.

windj007 avatar windj007 commented on August 24, 2024

Please note that most our scripts use Hydra configuration system - so no need to change YAML files, for ad-hoc modifications use can just override any parameter via command line.

from lama.

varungupta31 avatar varungupta31 commented on August 24, 2024

Thanks for the reply @windj007.

Changing dataset.img_suffix=.jpg at the given location did not resolve the issue. I still get the message:

- Make val dataloader default from /home2/varungupta/lama/ts_images/
0it [00:00, ?it/s]

Please note that most our scripts use Hydra configuration system - so no need to change YAML files, for ad-hoc modifications use can just override any parameter via command line.

I was following the instructions mentioned in the readme, as mentioned under point 2.Prepare images and masks ---->
Specify image_suffix, e.g. .png or .jpg or _input.jpg in configs/prediction/default.yaml.

and thus updated the YAML to replace .png to .jpg. Am I missing something still?

from lama.

windj007 avatar windj007 commented on August 24, 2024

Hi! Is your question resolved? If not, could you please provide more details on what parameters do you use and how the data look like?

from lama.

varungupta31 avatar varungupta31 commented on August 24, 2024

No, the model does work as intended with .png, but not with .jpg files. I tried your suggested solution but that didn't work.
Also, you stated that

Please note that most our scripts use Hydra configuration system - so no need to change YAML files, for ad-hoc modifications use can just override any parameter via command line.

So, is the readme incorrect? (Point 2 of readme stated above). If so, kindly update it.

could you please provide more details on what parameters do you use and how the data look like?

I didn't change much parameters, only the YAML file chage mentioned in the readme. Further, I also tried your suggested update of dataset.img_suffix=.jpg. But the errors (mentioned in the issue) persisted.

Sample Image (in png format)
20210812155640_0060__53__pedestrian-crossing__919

I managed around this issue by changing to .png format. So, this doesn't concern me as of now. Feel-free to close this issue, if you wish.

from lama.

jcrbsa avatar jcrbsa commented on August 24, 2024

Hi, everyone !

I've tested too, The same situation described by varungupta31 happens. For me it doesnt work editing the yaml file or passing as argument.

python bin\predict.py model.path=.\big-lama indir=.\jpg_images outdir=.\output dataset.img_suffix=.jpg

from lama.

windj007 avatar windj007 commented on August 24, 2024

Sorry for a long discussion and confusion. I forgot to highlight it from the beginning: dataset.img_suffix only changes how to obtain image filename from mask filename.

The algo is as follows:

  1. obtain a list of mask files by pattern "*mask*.png", which cannot be changed from a config
  2. for each mask file, obtain the corresponding image file by removing everything after _mask and adding the value of dataset.img_suffix

Thus, if you have masks in jpg, then changing configs will not help you - the script just will not find any masks in the input folder.

Please note that storing masks in JPG might be suboptimal - JPG is a lossless format and thus the mask after loading is not binary (only 0 and 1s) - it has a kind of gradient on mask boundary. The latter in its turn leads to severe artifacts.

Even if the masks are stored in PNG, the images can be stored in any other format, which PIL or cv2 can load - just set dataset.img_suffix accordingly. However, we did not test it with anything except PNG and JPG.

Takeaway: either store your masks in PNG or modify the code so it binarizes the masks after loading.

from lama.

windj007 avatar windj007 commented on August 24, 2024

Note about mask binarization: predict.py actually does binarization - I forgot about this line. But anyway, having smooth masks is meaningless and it's better to control it manually.

from lama.

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.