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

about py2.7 topy3.5 #2

Open
lz666win opened this issue Sep 26, 2018 · 3 comments
Open

about py2.7 topy3.5 #2

lz666win opened this issue Sep 26, 2018 · 3 comments

Comments

@lz666win
Copy link

Sorry to bother you,but I notice that you use python2.7,now I want to transform it to python3.5,.But in py3.5,filter produce a generator format, not like py2.7(list format),I do not know how to transform it so I delete the line48 and 95(fileList.sort() can not work).
but problem still happened:
Traceback (most recent call last):
File "C:/Users/lz666/PycharmProjects/promise12_segmentation/codes/train.py", line 233, in
n_imgs=15*10**4, batch_size=32)
File "C:/Users/lz666/PycharmProjects/promise12_segmentation/codes/train.py", line 167, in keras_fit_generator
data_to_array(img_rows, img_cols)
File "C:/Users/lz666/PycharmProjects/promise12_segmentation/codes/train.py", line 72, in data_to_array
images = np.concatenate( images , axis=0 ).reshape(-1, img_rows, img_cols, 1)
ValueError: need at least one array to concatenate
I do not think that is the problem with py2.7 and 3.5,I use CPU only,can you fix it or transform it to py3.5?

@mirzaevinom
Copy link
Owner

mirzaevinom commented Sep 26, 2018

Hi @lz666win. Don't delete that line. fileList needs to be sorted. Instead I would suggest doing something like:

    fileList =  list(os.listdir('../data/train/'))
    fileList = list(filter(lambda x: '.mhd' in x, fileList))
    fileList.sort()

@lz666win
Copy link
Author

Sorry to bother you again.I finished train.py and began test.py, problem happened:
127/127 [==============================] - 30s 236ms/step
Results on validation set
Accuracy: 0.8315926206157773
Traceback (most recent call last):
File "F:/promise2012/promise12_segmentation-master/codes/test.py", line 255, in
check_predictions( val_list, plot=True)
File "F:/promise2012/promise12_segmentation-master/codes/test.py", line 202, in check_predictions
surfd = surface_dist(y_true , y_pred_up, sampling=spacing)
File "F:\promise2012\promise12_segmentation-master\codes\metrics.py", line 52, in surface_dist
S = input_1 - morphology.binary_erosion(input_1, conn)
TypeError: numpy boolean subtract, the - operator, is deprecated, use the bitwise_xor, the ^ operator, or the logical_xor function instead.
I check your metiric.py ,the function is surface_dist(input1, input2, sampling=1, connectivity=1),I do not know what it is for,but as I thought, both input_1 and conn are boolean type,they can not minnus,so can you fix it?

@DrraBL
Copy link

DrraBL commented Feb 23, 2021

@lz666win
hi If you still not resolved the mentioned error, i suggest you to change - by ^
So I trying to run this repository but i meet an error also in test file in the following line:
imgs = [ X_test[n_imgs[row[0]-1]+row[1]] for row in case_slices ]
So from where you obtaained the testsamples folder?, for me, I recupared some png images from promise12.
please if you meeto this error and you found solution, please let me.
Thank you in advance

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

3 participants