Skip to content

Commit

Permalink
Antialias renamed to Lanczos (#130)
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidFV2296190 authored Mar 1, 2024
1 parent ae743b0 commit d977c82
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion examples/classify_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def main():
raise ValueError('Only support uint8 input type.')

size = common.input_size(interpreter)
image = Image.open(args.input).convert('RGB').resize(size, Image.ANTIALIAS)
image = Image.open(args.input).convert('RGB').resize(size, Image.LANCZOS)

# Image data must go through two transforms before running inference:
# 1. normalization: f = (input - mean) / std
Expand Down
2 changes: 1 addition & 1 deletion examples/detect_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def main():

image = Image.open(args.input)
_, scale = common.set_resized_input(
interpreter, image.size, lambda size: image.resize(size, Image.ANTIALIAS))
interpreter, image.size, lambda size: image.resize(size, Image.LANCZOS))

print('----INFERENCE TIME----')
print('Note: The first inference is slow because it includes',
Expand Down
2 changes: 1 addition & 1 deletion examples/model_pipelining_classify_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def main():
size = common.input_size(runner.interpreters()[0])
name = common.input_details(runner.interpreters()[0], 'name')
image = np.array(
Image.open(args.input).convert('RGB').resize(size, Image.ANTIALIAS))
Image.open(args.input).convert('RGB').resize(size, Image.LANCZOS))

def producer():
for _ in range(args.count):
Expand Down
2 changes: 1 addition & 1 deletion examples/movenet_pose_estimation.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def main():
interpreter.allocate_tensors()

img = Image.open(args.input)
resized_img = img.resize(common.input_size(interpreter), Image.ANTIALIAS)
resized_img = img.resize(common.input_size(interpreter), Image.LANCZOS)
common.set_input(interpreter, resized_img)

interpreter.invoke()
Expand Down
4 changes: 2 additions & 2 deletions examples/semantic_segmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ def main():
img = Image.open(args.input)
if args.keep_aspect_ratio:
resized_img, _ = common.set_resized_input(
interpreter, img.size, lambda size: img.resize(size, Image.ANTIALIAS))
interpreter, img.size, lambda size: img.resize(size, Image.LANCZOS))
else:
resized_img = img.resize((width, height), Image.ANTIALIAS)
resized_img = img.resize((width, height), Image.LANCZOS)
common.set_input(interpreter, resized_img)

interpreter.invoke()
Expand Down
2 changes: 1 addition & 1 deletion tests/detect_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def get_objects(model_file, delegate, image_file, score_threshold=0.0):
interpreter.allocate_tensors()
image = Image.open(test_utils.test_data_path(image_file))
_, scale = common.set_resized_input(
interpreter, image.size, lambda size: image.resize(size, Image.ANTIALIAS))
interpreter, image.size, lambda size: image.resize(size, Image.LANCZOS))
interpreter.invoke()
return detect.get_objects(
interpreter, score_threshold=score_threshold, image_scale=scale)
Expand Down
2 changes: 1 addition & 1 deletion tests/multiple_tpus_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def detection_task(num_inferences):
_, scale = common.set_resized_input(
interpreter,
img.size,
lambda size, image=img: image.resize(size, Image.ANTIALIAS))
lambda size, image=img: image.resize(size, Image.LANCZOS))
interpreter.invoke()
ret = detect.get_objects(
interpreter, score_threshold=0.7, image_scale=scale)
Expand Down
2 changes: 1 addition & 1 deletion tests/segment_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def segment_image(model_file, delegate, image_file, mask_file):
interpreter.allocate_tensors()

image = Image.open(test_utils.test_data_path(image_file)).resize(
common.input_size(interpreter), Image.ANTIALIAS)
common.input_size(interpreter), Image.LANCZOS)
common.set_input(interpreter, image)
interpreter.invoke()

Expand Down

0 comments on commit d977c82

Please sign in to comment.