From 6dabf8727afe8bc77717f86ab73d972b01d5a845 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Thu, 22 Jun 2023 10:55:50 +0200 Subject: [PATCH] Fix order of import statements for shapely issue Signed-off-by: Stefan Weil --- ocrd_detectron2/segment.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ocrd_detectron2/segment.py b/ocrd_detectron2/segment.py index 7cf70b2..f8fc18f 100644 --- a/ocrd_detectron2/segment.py +++ b/ocrd_detectron2/segment.py @@ -11,6 +11,8 @@ import multiprocessing.sharedctypes import ctypes import numpy as np +# torch must be imported before shapely 1.8, see issue shapely#1598. +import torch from shapely.geometry import Polygon from shapely.ops import unary_union import cv2 @@ -20,7 +22,6 @@ from detectron2.utils import visualizer from detectron2.config import get_cfg from detectron2.data import MetadataCatalog #, DatasetCatalog -import torch from ocrd_utils import ( getLogger,