diff --git a/cvat-ui/src/utils/dextr-utils.ts b/cvat-ui/src/utils/dextr-utils.ts index 9e815374201e..2a0b1e03ec80 100644 --- a/cvat-ui/src/utils/dextr-utils.ts +++ b/cvat-ui/src/utils/dextr-utils.ts @@ -199,7 +199,9 @@ const plugin: DEXTRPlugin = { // eslint-disable-next-line no-param-reassign self.data.canceled = false; antModalButton.disabled = true; - document.body.removeChild(antModalRoot); + if (antModalRoot.parentElement === document.body) { + document.body.removeChild(antModalRoot); + } } }, }, diff --git a/cvat/apps/dextr_segmentation/dextr.py b/cvat/apps/dextr_segmentation/dextr.py index c51eeaba134b..9bb3f3ba3112 100644 --- a/cvat/apps/dextr_segmentation/dextr.py +++ b/cvat/apps/dextr_segmentation/dextr.py @@ -50,7 +50,7 @@ def handle(self, db_data, frame, points): points = np.asarray([[int(p["x"]), int(p["y"])] for p in points], dtype=int) # Padding mustn't be more than the closest distance to an edge of an image - [width, height] = numpy_image.shape[:2] + [height, width] = numpy_image.shape[:2] x_values = points[:, 0] y_values = points[:, 1] [min_x, max_x] = [np.min(x_values), np.max(x_values)] @@ -59,8 +59,8 @@ def handle(self, db_data, frame, points): bounding_box = ( max(min(points[:, 0]) - padding, 0), max(min(points[:, 1]) - padding, 0), - min(max(points[:, 0]) + padding, numpy_image.shape[1] - 1), - min(max(points[:, 1]) + padding, numpy_image.shape[0] - 1) + min(max(points[:, 0]) + padding, width - 1), + min(max(points[:, 1]) + padding, height - 1) ) # Prepare an image