File tree Expand file tree Collapse file tree 4 files changed +17
-6
lines changed
perception_encoder/vision_encoder Expand file tree Collapse file tree 4 files changed +17
-6
lines changed Original file line number Diff line number Diff line change 1- __version__ = "0.57.4 "
1+ __version__ = "0.58.0 "
22
33
44if __name__ == "__main__" :
Original file line number Diff line number Diff line change 1- """ CLIP tokenizer
1+ """CLIP tokenizer
22
33Copied from https://github.com/openai/CLIP. Originally MIT License, Copyright (c) 2021 OpenAI.
44"""
Original file line number Diff line number Diff line change 1- from inference .models .rfdetr .rfdetr import RFDETRObjectDetection
2- from inference .models .rfdetr .rfdetr import RFDETRInstanceSegmentation
1+ from inference .models .rfdetr .rfdetr import (
2+ RFDETRInstanceSegmentation ,
3+ RFDETRObjectDetection ,
4+ )
5+
36__all__ = ["RFDETRObjectDetection" , "RFDETRInstanceSegmentation" ]
Original file line number Diff line number Diff line change @@ -717,13 +717,21 @@ def make_response(
717717 masks = [pred [7 ] for pred in predictions [image_ind ]]
718718 orig_h , orig_w = img_dims [image_ind ]
719719 prediction_h , prediction_w = self .mask_shape [0 ], self .mask_shape [1 ]
720+
720721 mask_preds = []
721722 for mask in masks :
722723 points = mask2poly (mask .astype (np .uint8 ))
723724 new_points = []
724725 for point in points :
725- new_x = point [0 ] * (orig_w / prediction_w )
726- new_y = point [1 ] * (orig_h / prediction_h )
726+ if self .resize_method == "Stretch to" :
727+ new_x = point [0 ] * (orig_w / prediction_w )
728+ new_y = point [1 ] * (orig_h / prediction_h )
729+ else :
730+ scale = max (orig_w / prediction_w , orig_h / prediction_h )
731+ pad_x = (orig_w - prediction_w * scale ) / 2
732+ pad_y = (orig_h - prediction_h * scale ) / 2
733+ new_x = point [0 ] * scale + pad_x
734+ new_y = point [1 ] * scale + pad_y
727735 new_points .append (np .array ([new_x , new_y ]))
728736 mask_preds .append (new_points )
729737 batch_mask_preds .append (mask_preds )
You can’t perform that action at this time.
0 commit comments