Closed yuanpeng5 closed 5 years ago
I found the reason, it seems in niftynet
class ImageReader(Layer):
It is required that input numpy array dtype must be the same as output numpy array dtype. So if we use png file as input numpy array, the output numpy array is required to be int32. So we can just change the input numpy array dtype to float64, the problem would be solved.
thanks for tracking this down @yuanpeng5, the reader infers dtypes by https://github.com/NifTK/NiftyNet/blob/v0.4.0/niftynet/io/misc_io.py#L59-L88
so, perphaps setting interp_order
of [image]
section in the config to 0 or 1 would resolve this issue? please let me know if this is not the case.
Hi, @yuanpeng5. I alwo want to try the classification application. My label file is a csv file with the following format
filename | label |
---|---|
img-1.nii | 1 |
img-2.nii | 0 |
img-3.nii | 1 |
img-4.nii | 0 |
...
could you tell me how to map this label file to the input data in the niftynet?
@EdwardMa12593 Sorry, I didn't see this, but just in case you still need this, you can name your images files as,
1-img.nii 2-img.nii ...
and generate label files as 1-label.tiff 2-label.tiff ...
and in your .ini config specify
[img] filename_contains = img
[label] filename_contains = label
NiftyNet should generate the .csv file automatically, or you can write your own .csv files and use them directly in the .ini file.
@wyli Yes, I think you are right, this should also fix the problem, I didn't find that part of code before.
@yuanpeng5 Get it. Thanks for your help very much.
Is it possible to get accuracy in logs?
I have already tried "Segmentation" application, and everything works fine. Now I am trying to run "Classification" application with with mnist dataset as a test. I have generate all image files as 28x28x1 png files and label files as 1x1x1 png files but after " INFO:niftynet: Parameters from random initialisations ... "
It keeps give me the following error:
It looks like something is the output_types are define as int32, but I didn't find anywhere I can change that.
This is my config.ini
I didn't find any detailed "Classification" tutorials in the demo part, so I created a mnist test to warm up. If anyone can shed me some light what is wrong here, that would be very much appreciated.