jcreinhold / synthtorch

deep neural network-based image translation/synthesis
Other
27 stars 7 forks source link

Does "nn-predit" take two folders as input #20

Closed joyschen closed 3 years ago

joyschen commented 3 years ago

I've trained a model to synthesize t2 images from flair and t1 images. Now I'm trying to use "nn-predict" to check out synthesized results. Here's part of the config.json.

"Required": {
    "predict_dir": [
      "./data/0.7mm/skull/predict/t1/", 
      "./data/0.7mm/skull/predict/flair/"

    ],
    "predict_out": "./data/0.7mm/skull/predict/synthesized/synthesized_",
    "source_dir": [
      "./data/0.7mm/skull/flair/",
      "./data/0.7mm/skull/t1/"
    ],
    "target_dir": [
      "./data/0.7mm/skull/t2/"
    ],
    "trained_model": "./model_dir/unet.0.7mm.200.pth"
}

I wonder if "nn-predict" takes two folders as the input.

Here's the console output

2021-04-15 16:47:07,891 - synthtorch.exec.nn_predict - INFO - Starting synthesis of image: predict1_t1 (1/6)
2021-04-15 16:47:44,836 - synthtorch.exec.nn_predict - INFO - Finished synthesis. Saved as: ./data/0.7mm/skull/predict/synthesized/synthesized_0_0.nii.gz
2021-04-15 16:47:44,836 - synthtorch.exec.nn_predict - INFO - Starting synthesis of image: predict2_t1 (2/6)
2021-04-15 16:48:20,587 - synthtorch.exec.nn_predict - INFO - Finished synthesis. Saved as: ./data/0.7mm/skull/predict/synthesized/synthesized_1_0.nii.gz
2021-04-15 16:48:20,587 - synthtorch.exec.nn_predict - INFO - Starting synthesis of image: predict3_t1 (3/6)
2021-04-15 16:48:56,339 - synthtorch.exec.nn_predict - INFO - Finished synthesis. Saved as: ./data/0.7mm/skull/predict/synthesized/synthesized_2_0.nii.gz
2021-04-15 16:48:56,339 - synthtorch.exec.nn_predict - INFO - Starting synthesis of image: predict4_t1 (4/6)
2021-04-15 16:49:32,863 - synthtorch.exec.nn_predict - INFO - Finished synthesis. Saved as: ./data/0.7mm/skull/predict/synthesized/synthesized_3_0.nii.gz
2021-04-15 16:49:32,863 - synthtorch.exec.nn_predict - INFO - Starting synthesis of image: predict5_t1 (5/6)
2021-04-15 16:50:08,993 - synthtorch.exec.nn_predict - INFO - Finished synthesis. Saved as: ./data/0.7mm/skull/predict/synthesized/synthesized_4_0.nii.gz
2021-04-15 16:50:08,993 - synthtorch.exec.nn_predict - INFO - Starting synthesis of image: predict6_t1 (6/6)
2021-04-15 16:50:45,071 - synthtorch.exec.nn_predict - INFO - Finished synthesis. Saved as: ./data/0.7mm/skull/predict/synthesized/synthesized_5_0.nii.gz

It looks like "nn-predict" takes the first folder defined in "predict_dir" only. Can anyone please clarify?

jcreinhold commented 3 years ago

From the console output, it looks like nn-predict worked. What is the issue?

Are the results bad? It might be because you trained the network with FLAIR images in the first spot and T1 images in the second spot (according to your source_dir field), and you swapped the order in the predict_dir field.

Or are you concerned that only the first directory is used because it states Starting synthesis of image: predict1_t1...? That is just a logging message to indicate which image is being synthesized. It is using both directories. If you didn't supply the right number of directories, nn-predict would raise an error.

joyschen commented 3 years ago

Hi @jcreinhold Thanks for the quick response. My concern mostly came from the logging message. Thank you for the clarification, and I'll close the ticket then.