Skip to content

关于多尺度预测 #59

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

Open
swjtulinxi opened this issue Jul 31, 2020 · 0 comments
Open

关于多尺度预测 #59

swjtulinxi opened this issue Jul 31, 2020 · 0 comments

Comments

@swjtulinxi
Copy link

这里多尺度预测说对于大于原图的采用裁剪的方式,请问是否也采用的滑动窗口预测呢?但是代码里没有采用滑动窗口的代码啊
def predict_multiscale(net, image, tile_size, scales, classes, flip_evaluation, recurrence):
"""
Predict an image by looking at it with different scales.
We choose the "predict_whole_img" for the image with less than the original input size,
for the input of larger size, we would choose the cropping method to ensure that GPU memory is enough.
"""
image = image.data
N_, C_, H_, W_ = image.shape
full_probs = np.zeros((H_, W_, classes))
for scale in scales:
scale = float(scale)
print("Predicting image scaled by %f" % scale)
scale_image = ndimage.zoom(image, (1.0, 1.0, scale, scale), order=1, prefilter=False)
scaled_probs = predict_whole(net, scale_image, tile_size, recurrence)
if flip_evaluation == True:
flip_scaled_probs = predict_whole(net, scale_image[:,:,:,::-1].copy(), tile_size, recurrence)
scaled_probs = 0.5 * (scaled_probs + flip_scaled_probs[:,::-1,:])
full_probs += scaled_probs
full_probs /= len(scales)
return full_probs

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