mirror of
https://github.com/qurator-spk/sbb_pixelwise_segmentation.git
synced 2025-06-09 20:00:05 +02:00
increasing margin in the case of pixelwise inference
This commit is contained in:
parent
f2692cf8dd
commit
c340fbb721
1 changed files with 4 additions and 3 deletions
|
@ -219,7 +219,7 @@ class sbb_predict:
|
||||||
|
|
||||||
added_image = cv2.addWeighted(img,0.5,output,0.1,0)
|
added_image = cv2.addWeighted(img,0.5,output,0.1,0)
|
||||||
|
|
||||||
return added_image
|
return added_image, output
|
||||||
|
|
||||||
def predict(self):
|
def predict(self):
|
||||||
self.start_new_session_and_model()
|
self.start_new_session_and_model()
|
||||||
|
@ -444,7 +444,7 @@ class sbb_predict:
|
||||||
|
|
||||||
if img.shape[1] < self.img_width:
|
if img.shape[1] < self.img_width:
|
||||||
img = cv2.resize(img, (self.img_height, img.shape[0]), interpolation=cv2.INTER_NEAREST)
|
img = cv2.resize(img, (self.img_height, img.shape[0]), interpolation=cv2.INTER_NEAREST)
|
||||||
margin = int(0 * self.img_width)
|
margin = int(0.1 * self.img_width)
|
||||||
width_mid = self.img_width - 2 * margin
|
width_mid = self.img_width - 2 * margin
|
||||||
height_mid = self.img_height - 2 * margin
|
height_mid = self.img_height - 2 * margin
|
||||||
img = img / float(255.0)
|
img = img / float(255.0)
|
||||||
|
@ -562,9 +562,10 @@ class sbb_predict:
|
||||||
print(self.save)
|
print(self.save)
|
||||||
cv2.imwrite(self.save,res)
|
cv2.imwrite(self.save,res)
|
||||||
else:
|
else:
|
||||||
img_seg_overlayed = self.visualize_model_output(res, self.img_org, self.task)
|
img_seg_overlayed, only_prediction = self.visualize_model_output(res, self.img_org, self.task)
|
||||||
if self.save:
|
if self.save:
|
||||||
cv2.imwrite(self.save,img_seg_overlayed)
|
cv2.imwrite(self.save,img_seg_overlayed)
|
||||||
|
cv2.imwrite('./layout.png', only_prediction)
|
||||||
|
|
||||||
if self.ground_truth:
|
if self.ground_truth:
|
||||||
gt_img=cv2.imread(self.ground_truth)
|
gt_img=cv2.imread(self.ground_truth)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue