promise12_segmentation icon indicating copy to clipboard operation
promise12_segmentation copied to clipboard

about py2.7 topy3.5

Open lz666win opened this issue 7 years ago • 3 comments

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?

lz666win avatar Sep 26 '18 12:09 lz666win

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()

mirzaevinom avatar Sep 26 '18 18:09 mirzaevinom

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?

lz666win avatar Sep 28 '18 11:09 lz666win

@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

DrraBL avatar Feb 23 '21 21:02 DrraBL