Lydorn / Polygonization-by-Frame-Field-Learning

This repository contains the code for our fast polygonal building extraction from overhead images pipeline.
BSD 3-Clause "New" or "Revised" License
294 stars 70 forks source link

No output after running an Inference on an image. #24

Open Roy2xc opened 3 years ago

Roy2xc commented 3 years ago

After I run "python main.py --run_name mapping_dataset.unet_resnet101_pretrained.train_val --in_filepath /home/yqs/Polygonization-by-Frame-Field-Learning/frame_field_learning/runs/images/1.jpg" The shell show me: Infer images: 100%|███████████████████████████████████████████████████████████████| 1/1 [00:01<00:00, 1.13s/it, status=Saving output] But I cannot find the output image anyway... Could you pls give me some hint? Thank you very much!

patriksabol commented 3 years ago

The output should be in the same directory as the input image in the form of multiple directories that represent different outputs. Are you sure that the script ended without any error?

Roy2xc commented 3 years ago

Yes, there is no error. And I find that this code with never run... I set the config["compute_seg"] = True, and config["eval_params"]["save_individual_outputs"]["seg_mask"] =True, then I can find the output image. Here is the code:

    ##why##
    #config["compute_seg"] = True
    #config["eval_params"]["save_individual_outputs"]["seg_mask"] = True

    if config["compute_seg"]:
        if config["eval_params"]["save_individual_outputs"]["seg_mask"]:
            seg_mask = 0.5 < tile_data["seg"][0]
            save_utils.save_seg_mask(seg_mask, out_base_filepath, "mask", tile_data["image_filepath"])
        if config["eval_params"]["save_individual_outputs"]["seg"]:
            save_utils.save_seg(tile_data["seg"], out_base_filepath, "seg", tile_data["image_filepath"])
        if config["eval_params"]["save_individual_outputs"]["seg_luxcarta"]:
            save_utils.save_seg_luxcarta_format(tile_data["seg"], out_base_filepath, "seg_luxcarta_format", 
        tile_data["image_filepath"])

I'm still confused that why this part of code never run. Sorry for my bad English, I wish you could understand what I mean :)

patriksabol commented 3 years ago

Try to set breakpoint at first 'if' statement, and inspect it. I am sure the problem is somewhere in config, or this particular code is not able to read config properly.

Roy2xc commented 3 years ago

python main.py --run_name mapping_dataset.unet_resnet101_pretrained.field_off.train_val --in_filepath /home/yqs/Polygonization-by-Frame-Field-Learning/frame_field_learning/runs/images/1.jpg

I just try to run a inference by this command, and it will show no error but no output either. I had never modify the code. I tried breakpoint but everything is OK...

Roy2xc commented 3 years ago

Shall I use -c config when running a inference?

patriksabol commented 3 years ago

Command is OK, you do not have to use -c config. Are you sure that config["compute_seg"] is set to True when running code?

Roy2xc commented 3 years ago

Yes, I set it to True by adding code into inference_from_filepath , and it works. But if I don't add that code, there will be no error and no output. I'm sure I just followed your instruction...

Anne-69 commented 3 years ago

I also have the same problem as Author Roy2xc

patriksabol commented 3 years ago

I have just run it and debugged it. config["compute_seg"] is set to True, but inner 'ifs' as set to False (such as config["eval_params"]["save_individual_outputs"]["seg_mask"]). You need to set them to True. Try to set them in the code. Such as: config["eval_params"]["save_individual_outputs"]["seg_mask"] = True config["eval_params"]["save_individual_outputs"]["seg"] = True and so on

Anne-69 commented 3 years ago

I have set them in the code, such as: config["eval_params"]["save_individual_outputs"]["seg_mask"] = True config["eval_params"]["save_individual_outputs"]["seg"] = True Still no output.

Anne-69 commented 3 years ago

I know how to change it, the config under run_name should be modified.

Roy2xc commented 3 years ago

I know how to change it, the config under run_name should be modified.

Hi Anne, could you tell me which config should be modified? What does run_name mean? A file name?

Anne-69 commented 3 years ago

I modified the config file under run_name,your run_name maybe mapping_dataset.unet_resnet101_pretrained.train_val, such as config["save_individual_outputs"]["seg_mask"] = True config["save_individual_outputs"]["seg"] = True

Sorry, my English is bad, I wish you can understand what I mean.

Roy2xc commented 3 years ago

Thank you so much !