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

Testing new Image #23

Open
ZshahRA opened this issue May 5, 2020 · 2 comments
Open

Testing new Image #23

ZshahRA opened this issue May 5, 2020 · 2 comments

Comments

@ZshahRA
Copy link

ZshahRA commented May 5, 2020

Hello @HYOJINPARK ,

I successfully trained the ExtremeC3Net. Now I want to test new images to see the testing accuracy. I am not sure what to do next. I tried putting images in Link512DATA folder and run Test_model.py. But there is no option to show images results.

  1. Where I should put my testing images? I mean which folder.
  2. And how to see segmented results? I can't see any of the following. I am not sure where?
    cv2.imwrite("%s.jpg" %idx,np.asarray(segmented))
    fig, axes = plt.subplots(1, 2, figsize=(12, 10))
    axes[0].imshow(image)

Your response would be highly appreciated. Thank you

@HYOJINPARK
Copy link
Collaborator

HYOJINPARK commented May 5, 2020

Dear @ZshahRA

Sorry to uncomfortable showing result images

please refer main.py line 247 to add image information to visdom.

 if args.visualize:
                if train_config["loss"] == "Lovasz":
                    grid_outputs = torchvision.utils.make_grid(color_transform((save_est[0] > 0).cpu().data), nrow=6)
                else:
                    grid_outputs = torchvision.utils.make_grid(
                        color_transform(save_est[0].unsqueeze(0).cpu().max(1)[1].data), nrow=6)

This is visualized the validation image.
If you want own image please refer "./etc/Visualize_video"
You can test your custom video file.

@ZshahRA
Copy link
Author

ZshahRA commented May 5, 2020

Thank you @HYOJINPARK,
I tried visualize_video, I had the following issues.

  1. File "Visualize_video.py", line 19, in
    from etc.utils import * # commented by rahmat this line only
    ModuleNotFoundError: No module named 'etc'
    I used the following code, but again it shows the same issue.
    conda install -c conda-forge python-utils

  2. I commented from etc.utils import *. so that I can run the code and i input my model information from line 253 in visualize_video.py as shown below.

if name == 'main':
import models
parser = ArgumentParser()
parser.add_argument('-c', '--config', type=str, default='./setting/ExtremeC3Net.json', #parser.add_argument('-c', '--config', type=str, default='../setting/SINet.json',
help='JSON file for configuration')
Max_name = "./result/Stage2_ExtremeC3Net05-04_0316/model_234.pth" #Max_name = "../result/Dnc_SINet11-24_2218/model_3.pth"
logdir= "./video/Stage2_ExtremeC3Net05-04_0316" #logdir= "../video/Dnc_SINet11-24_2218"
mean = [107.304565, 115.69884, 132.35703 ]
std = [63.97182, 65.1337, 68.29726]
args = parser.parse_args()
with open(args.config) as fin:
config = json.load(fin)
train_config = config['train_config']
data_config = config['data_config']
model_name = "Stage2_ExtremeC3" #model_name = "Dnc_SINet"
Lovasz = train_config["loss"] == "Lovasz"
if Lovasz:
train_config["num_classes"] = train_config["num_classes"] -1
model = models.dict[model_name](classes=train_config["num_classes"],
p=train_config["p"], q=train_config["q"], chnn=train_config["chnn"])
if torch.cuda.device_count() > 0:
model=model.cuda()
ExportVideo(model, Max_name, "./video/", logdir, "video1.mp4", data_config["h"], data_config["w"], mean, std, Lovasz,
pil=False)

but i had the following issue

Traceback (most recent call last):
File "Visualize_video.py", line 254, in
import models
ModuleNotFoundError: No module named 'models'

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