Commit 658ccbca authored by Mao, Bojia's avatar Mao, Bojia
Browse files

Merge branch 'master' of gitlab.doc.ic.ac.uk:g207004202/explainable-multimodal-classification

parents ad94642b 28a62442
...@@ -14,7 +14,7 @@ def loadImage(img): ...@@ -14,7 +14,7 @@ def loadImage(img):
img = Image.open(requests.get(img, stream=True).raw) img = Image.open(requests.get(img, stream=True).raw)
else: else:
img = Image.open(img) img = Image.open(img)
else: else: # pragma: no cover
sys.exit("ERROR: Unsupported img type. Abort") sys.exit("ERROR: Unsupported img type. Abort")
return img return img
...@@ -52,7 +52,7 @@ class SmartTextRemover: ...@@ -52,7 +52,7 @@ class SmartTextRemover:
""" """
# Create a new named window if required # Create a new named window if required
if show_boxes: if show_boxes: # pragma: no cover
kWinName = "EAST: An Efficient and Accurate Scene Text Detector" kWinName = "EAST: An Efficient and Accurate Scene Text Detector"
cv.namedWindow(kWinName, cv.WINDOW_NORMAL) cv.namedWindow(kWinName, cv.WINDOW_NORMAL)
...@@ -106,7 +106,7 @@ class SmartTextRemover: ...@@ -106,7 +106,7 @@ class SmartTextRemover:
vertices_all[n, :, :] = vertices vertices_all[n, :, :] = vertices
# Add the boxes to current frame if required # Add the boxes to current frame if required
if show_boxes: if show_boxes: # pragma: no cover
for j in range(4): for j in range(4):
p1 = (vertices[j][0].astype(int), vertices[j][1].astype(int)) p1 = (vertices[j][0].astype(int), vertices[j][1].astype(int))
p2 = ( p2 = (
...@@ -116,7 +116,7 @@ class SmartTextRemover: ...@@ -116,7 +116,7 @@ class SmartTextRemover:
cv.line(img, p1, p2, (0, 255, 0), 1) cv.line(img, p1, p2, (0, 255, 0), 1)
# Display the image frame if required # Display the image frame if required
if show_boxes: if show_boxes: # pragma: no cover
cv.imshow(kWinName, img) cv.imshow(kWinName, img)
# waits for user to press any key # waits for user to press any key
...@@ -280,7 +280,7 @@ class SmartTextRemover: ...@@ -280,7 +280,7 @@ class SmartTextRemover:
return [detections, confidences] return [detections, confidences]
if __name__ == "__main__": if __name__ == "__main__": # pragma: no cover
remover = SmartTextRemover("mmxai/text_removal/frozen_east_text_detection.pb") remover = SmartTextRemover("mmxai/text_removal/frozen_east_text_detection.pb")
img = remover.inpaint("https://www.iqmetrix.com/hubfs/Meme%2021.jpg") img = remover.inpaint("https://www.iqmetrix.com/hubfs/Meme%2021.jpg")
img.show() img.show()
from numpy.__config__ import show
from numpy.lib.arraysetops import isin
from mmxai.text_removal.smart_text_removal import SmartTextRemover from mmxai.text_removal.smart_text_removal import SmartTextRemover
from PIL import Image from PIL import Image
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment