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

predict part #24

Open
fadili97 opened this issue Jun 7, 2020 · 0 comments
Open

predict part #24

fadili97 opened this issue Jun 7, 2020 · 0 comments

Comments

@fadili97
Copy link

fadili97 commented Jun 7, 2020

great work
I would like to be enlightned more about this part if you allow, because I couldnt get to understand its role in prediction part.
Thanks in advance:
for i in range(7): if i == 0: # reverse first dimension mymat = predict(img[::-1,:,:], model, patch_sz=PATCH_SZ, n_classes=N_CLASSES).transpose([2,0,1]) #print(mymat[0][0][0], mymat[3][12][13]) print("Case 1",img.shape, mymat.shape) elif i == 1: # reverse second dimension temp = predict(img[:,::-1,:], model, patch_sz=PATCH_SZ, n_classes=N_CLASSES).transpose([2,0,1]) #print(temp[0][0][0], temp[3][12][13]) print("Case 2", temp.shape, mymat.shape) mymat = np.mean( np.array([ temp[:,::-1,:], mymat ]), axis=0 ) elif i == 2: # transpose(interchange) first and second dimensions temp = predict(img.transpose([1,0,2]), model, patch_sz=PATCH_SZ, n_classes=N_CLASSES).transpose([2,0,1]) #print(temp[0][0][0], temp[3][12][13]) print("Case 3", temp.shape, mymat.shape) mymat = np.mean( np.array([ temp.transpose(0,2,1), mymat ]), axis=0 ) elif i == 3: temp = predict(np.rot90(img, 1), model, patch_sz=PATCH_SZ, n_classes=N_CLASSES) #print(temp.transpose([2,0,1])[0][0][0], temp.transpose([2,0,1])[3][12][13]) print("Case 4", temp.shape, mymat.shape) mymat = np.mean( np.array([ np.rot90(temp, -1).transpose([2,0,1]), mymat ]), axis=0 ) elif i == 4: temp = predict(np.rot90(img,2), model, patch_sz=PATCH_SZ, n_classes=N_CLASSES) #print(temp.transpose([2,0,1])[0][0][0], temp.transpose([2,0,1])[3][12][13]) print("Case 5", temp.shape, mymat.shape) mymat = np.mean( np.array([ np.rot90(temp,-2).transpose([2,0,1]), mymat ]), axis=0 ) elif i == 5: temp = predict(np.rot90(img,3), model, patch_sz=PATCH_SZ, n_classes=N_CLASSES) #print(temp.transpose([2,0,1])[0][0][0], temp.transpose([2,0,1])[3][12][13]) print("Case 6", temp.shape, mymat.shape) mymat = np.mean( np.array([ np.rot90(temp, -3).transpose(2,0,1), mymat ]), axis=0 ) else: temp = predict(img, model, patch_sz=PATCH_SZ, n_classes=N_CLASSES).transpose([2,0,1]) #print(temp[0][0][0], temp[3][12][13]) print("Case 7", temp.shape, mymat.shape) mymat = np.mean( np.array([ temp, mymat ]), axis=0 )

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

1 participant