uci-cbcl / NoduleNet

[MICCAI' 19] NoduleNet: Decoupled False Positive Reduction for Pulmonary Nodule Detection and Segmentation
Other
185 stars 57 forks source link

Test trained model on single image #20

Open valbertoenoc opened 4 years ago

valbertoenoc commented 4 years ago

Hello ,

Is it possible to run the trained model on a single CT scan? I've tried loading the provided checkpoint and running inference on a single CT scan, but ran into a number of problem. But the most relevant one is that the net forward method expects a number of inputs, truth_bboxes, masks, etc. I've also tried using the eval_single function, so I assumed the model was ready to receive a single ct scan input.

I appreciate the attention.

tanghaotommy commented 4 years ago

I am sorry that we did not provide such a script. But there are ways for doing that.

One easy way is to set those arguments (truth_boxes, masks) to None. Those GT arguments are used only in training mode (https://github.com/uci-cbcl/NoduleNet/blob/master/net/nodule_net.py#L365-L374).

valbertoenoc commented 4 years ago

Thanks for answering! I did pass the first error, but the second got me confused. What is exactly the expected input of the network. Is it a scan patch or the whole scan for inference?

I tried passing a whole scan, but got this error: RuntimeError: Expected 5-dimensional input for 5-dimensional weight 24 1 3 3 3, but got 4-dimensional input of size [1, 100, 512, 512] instead

I'm so sorry to disturb you at all on this matter.

tanghaotommy commented 4 years ago

The input is the 3D CT scan. PyTorch expects a 5-dimensional input for volumetric data. So your input should be [batch_size, channel, depth, height, width]. You need to add one more dimension to your input, e.g. using torch.unsqueeze(tensor, 0)

valbertoenoc commented 4 years ago

Hello Tang, that helped, thanks a lot. I have a couple of follow up questions though:

  1. I was able to run a forward pass, but got and GPU memory allocation error. I have a 1050Ti 4gb. How much memory is necessary to run a single scan?

  2. I couldn't make it run on the CPU because of DataParallel, I´m not familiar of how to use it.

  3. I was able to run only a single time, after that I got the following error without changing anything to the process, and I have no idea why. Would you happen to know something about this error? This is my input shape : [1,1,133,512,512]

Error:

comb2 = self.back2(torch.cat((rev2, out2), 1))#64+64 RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 1. Got 33 and 32 in dimension 2 at C:/w/1/s/tmp_conda_3.6_171155/conda/conda-bld/pytorch_1570813991702/work/aten/src\THC/generic/THCTensorMath.cu:71

Thank you again.

LXYTSOS commented 4 years ago

can you find the function average_precision()?

tanghaotommy commented 4 years ago

@valbertoenoc

  1. We use 1080ti with 12GB as minimum requirement. The alternative is to generate input patches with fixed size (e.g. 12812812) using sliding window.
  2. You may need to modify the code in order to run on CPU. We only tested on GPU
  3. This error is because the size of each dimension of the input must be a multiply of 16, as we downsample the input volume 4 times
913620614 commented 2 years ago

Excuse me,sir?!may I ask you for some help? my emil is 913620614@qq.com

thank you very much!