Spaces:
Build error
Build error
msIntui commited on
Commit ·
66da89f
1
Parent(s): 391393a
Fix logger initialization and add pytlsd dependency
Browse files- detectors.py +10 -9
- requirements.txt +1 -0
detectors.py
CHANGED
|
@@ -14,14 +14,12 @@ from ultralytics import YOLO
|
|
| 14 |
from PIL import Image
|
| 15 |
import matplotlib.pyplot as plt
|
| 16 |
from storage import StorageInterface
|
|
|
|
| 17 |
|
| 18 |
-
#
|
| 19 |
-
|
| 20 |
-
from detection_schema import DetectionContext
|
| 21 |
-
from utils import DebugHandler
|
| 22 |
-
from config import SymbolConfig, TagConfig, LineConfig, PointConfig, JunctionConfig
|
| 23 |
|
| 24 |
-
#
|
| 25 |
try:
|
| 26 |
from deeplsd.models.deeplsd_inference import DeepLSD
|
| 27 |
DEEPLSD_AVAILABLE = True
|
|
@@ -29,6 +27,12 @@ except ImportError as e:
|
|
| 29 |
logger.warning(f"DeepLSD import failed: {e}. Falling back to basic line detection.")
|
| 30 |
DEEPLSD_AVAILABLE = False
|
| 31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
# Detection schema: dataclasses for different objects
|
| 33 |
from detection_schema import (
|
| 34 |
BBox,
|
|
@@ -48,9 +52,6 @@ from detection_schema import (
|
|
| 48 |
from skimage.morphology import skeletonize
|
| 49 |
from skimage.measure import label
|
| 50 |
|
| 51 |
-
# Configure logging
|
| 52 |
-
logger = logging.getLogger(__name__)
|
| 53 |
-
|
| 54 |
class Detector(ABC):
|
| 55 |
"""Base class for all detectors"""
|
| 56 |
|
|
|
|
| 14 |
from PIL import Image
|
| 15 |
import matplotlib.pyplot as plt
|
| 16 |
from storage import StorageInterface
|
| 17 |
+
import logging
|
| 18 |
|
| 19 |
+
# Configure logging first
|
| 20 |
+
logger = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
+
# Then try imports that might fail
|
| 23 |
try:
|
| 24 |
from deeplsd.models.deeplsd_inference import DeepLSD
|
| 25 |
DEEPLSD_AVAILABLE = True
|
|
|
|
| 27 |
logger.warning(f"DeepLSD import failed: {e}. Falling back to basic line detection.")
|
| 28 |
DEEPLSD_AVAILABLE = False
|
| 29 |
|
| 30 |
+
# Base classes and utilities
|
| 31 |
+
from base import BaseDetector
|
| 32 |
+
from detection_schema import DetectionContext
|
| 33 |
+
from utils import DebugHandler
|
| 34 |
+
from config import SymbolConfig, TagConfig, LineConfig, PointConfig, JunctionConfig
|
| 35 |
+
|
| 36 |
# Detection schema: dataclasses for different objects
|
| 37 |
from detection_schema import (
|
| 38 |
BBox,
|
|
|
|
| 52 |
from skimage.morphology import skeletonize
|
| 53 |
from skimage.measure import label
|
| 54 |
|
|
|
|
|
|
|
|
|
|
| 55 |
class Detector(ABC):
|
| 56 |
"""Base class for all detectors"""
|
| 57 |
|
requirements.txt
CHANGED
|
@@ -17,6 +17,7 @@ torchvision>=0.15.0
|
|
| 17 |
ultralytics>=8.0.0
|
| 18 |
git+https://github.com/cvg/DeepLSD.git # Install DeepLSD from GitHub
|
| 19 |
omegaconf>=2.3.0 # Required by DeepLSD
|
|
|
|
| 20 |
|
| 21 |
# Graph Processing
|
| 22 |
networkx>=2.6.0
|
|
|
|
| 17 |
ultralytics>=8.0.0
|
| 18 |
git+https://github.com/cvg/DeepLSD.git # Install DeepLSD from GitHub
|
| 19 |
omegaconf>=2.3.0 # Required by DeepLSD
|
| 20 |
+
pytlsd # Required by DeepLSD
|
| 21 |
|
| 22 |
# Graph Processing
|
| 23 |
networkx>=2.6.0
|