msIntui commited on
Commit
391393a
·
1 Parent(s): 7f22c74

Add omegaconf dependency and DeepLSD fallback

Browse files
Files changed (2) hide show
  1. detectors.py +19 -4
  2. requirements.txt +5 -0
detectors.py CHANGED
@@ -21,8 +21,13 @@ from detection_schema import DetectionContext
21
  from utils import DebugHandler
22
  from config import SymbolConfig, TagConfig, LineConfig, PointConfig, JunctionConfig
23
 
24
- # DeepLSD model for line detection
25
- from deeplsd.models.deeplsd_inference import DeepLSD
 
 
 
 
 
26
 
27
  # Detection schema: dataclasses for different objects
28
  from detection_schema import (
@@ -122,10 +127,20 @@ class LineDetector(Detector):
122
  self.model_path = model_path
123
  self.model_config = model_config or {}
124
  self.device = device
 
125
 
126
  def detect(self, image: np.ndarray) -> Dict:
127
- """Detect lines using DeepLSD or other methods"""
128
- # Implement line detection logic
 
 
 
 
 
 
 
 
 
129
  return {'detections': []}
130
 
131
 
 
21
  from utils import DebugHandler
22
  from config import SymbolConfig, TagConfig, LineConfig, PointConfig, JunctionConfig
23
 
24
+ # Try to import DeepLSD, fall back to basic line detection if not available
25
+ try:
26
+ from deeplsd.models.deeplsd_inference import DeepLSD
27
+ DEEPLSD_AVAILABLE = True
28
+ 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 (
 
127
  self.model_path = model_path
128
  self.model_config = model_config or {}
129
  self.device = device
130
+ self.use_deeplsd = DEEPLSD_AVAILABLE
131
 
132
  def detect(self, image: np.ndarray) -> Dict:
133
+ """Detect lines using DeepLSD or fallback to basic methods"""
134
+ if self.use_deeplsd:
135
+ # Use DeepLSD
136
+ return self._detect_with_deeplsd(image)
137
+ else:
138
+ # Fallback to basic line detection
139
+ return self._detect_basic(image)
140
+
141
+ def _detect_basic(self, image: np.ndarray) -> Dict:
142
+ """Basic line detection using OpenCV"""
143
+ # Basic implementation
144
  return {'detections': []}
145
 
146
 
requirements.txt CHANGED
@@ -16,6 +16,7 @@ torch>=2.1.0
16
  torchvision>=0.15.0
17
  ultralytics>=8.0.0
18
  git+https://github.com/cvg/DeepLSD.git # Install DeepLSD from GitHub
 
19
 
20
  # Graph Processing
21
  networkx>=2.6.0
@@ -26,5 +27,9 @@ python-dotenv>=0.19.0
26
  loguru>=0.7.0
27
  matplotlib>=3.4.0
28
 
 
 
 
 
29
  # AI/Chat
30
  openai>=1.0.0
 
16
  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
 
27
  loguru>=0.7.0
28
  matplotlib>=3.4.0
29
 
30
+ # Azure Storage
31
+ azure-storage-blob>=12.0.0
32
+ azure-core>=1.24.0
33
+
34
  # AI/Chat
35
  openai>=1.0.0