Fix post process function called in the instance segmentation example of mask2former (#34588)

* Fix post process function called in the instance segmentation example of mask2former

* fix description and additional notes for post_process_instance_segmentation of maskformers

* remove white space in maskformers post_process_instance_segmentation doc

* change image.size[::-1] to height and width for clarity in segmentation examples
This commit is contained in:
David Zhang
2024-11-20 02:49:25 +11:00
committed by GitHub
parent fdb9230485
commit 427b62ed1a
8 changed files with 22 additions and 18 deletions

View File

@@ -148,7 +148,7 @@ with torch.no_grad():
outputs = model(**inputs)
# Post-process outputs
outputs = image_processor.post_process_instance_segmentation(outputs, target_sizes=[image.size[::-1]])
outputs = image_processor.post_process_instance_segmentation(outputs, target_sizes=[(image.height, image.width)])
print("Mask shape: ", outputs[0]["segmentation"].shape)
print("Mask values: ", outputs[0]["segmentation"].unique())