pytorch-segmentation-toolbox icon indicating copy to clipboard operation
pytorch-segmentation-toolbox copied to clipboard

关于多尺度预测

Open swjtulinxi opened this issue 4 years ago • 0 comments

这里多尺度预测说对于大于原图的采用裁剪的方式,请问是否也采用的滑动窗口预测呢?但是代码里没有采用滑动窗口的代码啊 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

swjtulinxi avatar Jul 31 '20 11:07 swjtulinxi