+
2Z
j* � � � R t ^ RIt^ RIt^ RIt^ RIt^ RItR R ltR R ltR t R R lt
R R
ltR R ltR
R lt
]R8X d ]! ]
! 4 4 hR# )a Full SAM3 inference backend used by the Rust `Sam3` wrapper.
This script intentionally delegates the full detector/tracker stack to the
official `facebookresearch/sam3` package. It is the complete execution path
for SAM3 image and base video while native RLX kernels are brought up.
Nc �0 � V ^8� d QhR\ R\ /# )� �name�return)�str)�formats "�(rlx-models/src/sam3/reference_backend.py�__annotate__r s � � � �c� �c� � c � � \ P P V 4 pVf5 \ RV 2\ P
R7 \ P ! ^4 V# )Nzmissing env var: ��file)�os�environ�get�print�sys�stderr�exit)r �values & r �envr s? � ��J�J�N�N�4� �E��}�
�!�$��(�s�z�z�:�������Lr
c � � V ^8� d QhRR/# )r r �
np.ndarray� )r s "r r r s � � !� !�,� !r
c �J � \ \ R 4 4 p \ \ R4 4 p\ P ! \ R4 \ P R7 pW, ^, pVP
V8w d \
RV RVP
24 hVP W^4 # )�RLX_SAM3_INPUT_H�RLX_SAM3_INPUT_W�RLX_SAM3_IMAGE_U8_BIN��dtypezimage expected z bytes, got )�intr �np�fromfile�uint8�size�
ValueError�reshape)�h�w�data�expecteds r �load_rgbr+ s� � ��C�"�#�$�A��C�"�#�$�A�
�;�;�s�2�3�2�8�8�D�D��u�q�y�H��y�y�H���?�8�*�L�����L�M�M��<�<��a� � r
c �� � V f R # \ V R4 '