Before you start the upgrade, make sure to upgrade to the latest available 3.5.x version. This will make sure that you are building against the most recent dependencies of that line. Please take time ...
from sam3.perflib.masks_ops import mask_iou, masks_to_boxes as perf_masks_to_boxes ...