Spaces:
Running
Running
update config
Browse files- README.md +3 -3
- comic_panel_extractor/annorator_server.py +11 -2
- comic_panel_extractor/border_panel_extractor.py +3 -3
- comic_panel_extractor/cli.py +2 -2
- comic_panel_extractor/config.py +3 -1
- comic_panel_extractor/config.toml +2 -1
- comic_panel_extractor/create_dataset.py +1 -1
- comic_panel_extractor/extractor_server.py +1 -2
- comic_panel_extractor/image_processor.py +2 -2
- comic_panel_extractor/inference.py +1 -1
- comic_panel_extractor/llm_panel_extractor.py +5 -6
- comic_panel_extractor/main.py +1 -1
- comic_panel_extractor/panel_extractor.py +1 -1
- comic_panel_extractor/server.py +1 -1
- comic_panel_extractor/static/annotator.html +0 -1
- comic_panel_extractor/text_detector.py +1 -1
- comic_panel_extractor/train.py +1 -1
- comic_panel_extractor/utils.py +1 -1
- comic_panel_extractor/yolo_manager.py +1 -2
README.md
CHANGED
|
@@ -41,9 +41,9 @@ comic-panel-extractor path/to/comic.jpg
|
|
| 41 |
**Python:**
|
| 42 |
```python
|
| 43 |
from comic_panel_extractor.main import ComicPanelExtractor
|
| 44 |
-
from comic_panel_extractor.config import Config
|
| 45 |
|
| 46 |
-
config =
|
| 47 |
config.input_path = "comic.jpg"
|
| 48 |
extractor = ComicPanelExtractor(config)
|
| 49 |
panels, data, paths = extractor.extract_panels_from_comic()
|
|
@@ -99,7 +99,7 @@ with YOLOManager() as yolo:
|
|
| 99 |
## Configuration
|
| 100 |
|
| 101 |
```python
|
| 102 |
-
config =
|
| 103 |
config.min_width_ratio = 0.15 # Min panel width (% of image)
|
| 104 |
config.min_height_ratio = 0.15 # Min panel height (% of image)
|
| 105 |
config.min_area_ratio = 0.05 # Min panel area (% of image)
|
|
|
|
| 41 |
**Python:**
|
| 42 |
```python
|
| 43 |
from comic_panel_extractor.main import ComicPanelExtractor
|
| 44 |
+
from comic_panel_extractor.config import Config, load_config
|
| 45 |
|
| 46 |
+
config = load_config()
|
| 47 |
config.input_path = "comic.jpg"
|
| 48 |
extractor = ComicPanelExtractor(config)
|
| 49 |
panels, data, paths = extractor.extract_panels_from_comic()
|
|
|
|
| 99 |
## Configuration
|
| 100 |
|
| 101 |
```python
|
| 102 |
+
config = load_config()
|
| 103 |
config.min_width_ratio = 0.15 # Min panel width (% of image)
|
| 104 |
config.min_height_ratio = 0.15 # Min panel height (% of image)
|
| 105 |
config.min_area_ratio = 0.05 # Min panel area (% of image)
|
comic_panel_extractor/annorator_server.py
CHANGED
|
@@ -18,7 +18,7 @@ import psutil
|
|
| 18 |
import subprocess
|
| 19 |
from . import common
|
| 20 |
import fcntl
|
| 21 |
-
from .config import load_config, update_toml_key
|
| 22 |
|
| 23 |
app = APIRouter()
|
| 24 |
|
|
@@ -423,7 +423,16 @@ async def save_config(request: TrainConfig):
|
|
| 423 |
update_toml_key("RESUME_TRAIN", request.resume_train)
|
| 424 |
|
| 425 |
return {'message': 'Config update successfully.', 'status': 'success'}
|
| 426 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 427 |
|
| 428 |
@app.get("/api/annotate/train")
|
| 429 |
async def upload_image():
|
|
|
|
| 18 |
import subprocess
|
| 19 |
from . import common
|
| 20 |
import fcntl
|
| 21 |
+
from .config import Config, load_config, update_toml_key
|
| 22 |
|
| 23 |
app = APIRouter()
|
| 24 |
|
|
|
|
| 423 |
update_toml_key("RESUME_TRAIN", request.resume_train)
|
| 424 |
|
| 425 |
return {'message': 'Config update successfully.', 'status': 'success'}
|
| 426 |
+
|
| 427 |
+
@app.post("/api/annotate/model_reset")
|
| 428 |
+
async def reset_model():
|
| 429 |
+
from pathlib import Path
|
| 430 |
+
file_path = Path(config.yolo_trained_model_path)
|
| 431 |
+
|
| 432 |
+
if file_path.exists():
|
| 433 |
+
file_path.unlink()
|
| 434 |
+
|
| 435 |
+
return {'message': 'Model Reseted', 'status': 'success'}
|
| 436 |
|
| 437 |
@app.get("/api/annotate/train")
|
| 438 |
async def upload_image():
|
comic_panel_extractor/border_panel_extractor.py
CHANGED
|
@@ -10,7 +10,7 @@ from scipy import ndimage as ndi
|
|
| 10 |
from skimage.morphology import remove_small_holes
|
| 11 |
import cv2
|
| 12 |
|
| 13 |
-
from .config import Config
|
| 14 |
from .image_processor import ImageProcessor
|
| 15 |
from .utils import remove_duplicate_boxes, count_panels_inside, extend_boxes_to_image_border
|
| 16 |
|
|
@@ -27,7 +27,7 @@ class BorderPanelExtractor:
|
|
| 27 |
|
| 28 |
def __init__(self, config: Config = None):
|
| 29 |
"""Initialize the BorderPanelExtractor with optional configuration."""
|
| 30 |
-
self.config = config or
|
| 31 |
self.output_folder = f'{self.config.output_folder}/border_panel_extractor'
|
| 32 |
os.makedirs(self.output_folder, exist_ok=True)
|
| 33 |
self.PANEL_FILENAME_PATTERN = re.compile(self.config.panel_filename_pattern)
|
|
@@ -640,7 +640,7 @@ class BorderPanelExtractor:
|
|
| 640 |
|
| 641 |
|
| 642 |
if __name__ == "__main__":
|
| 643 |
-
config =
|
| 644 |
config.input_path = "test0.jpg"
|
| 645 |
|
| 646 |
import shutil
|
|
|
|
| 10 |
from skimage.morphology import remove_small_holes
|
| 11 |
import cv2
|
| 12 |
|
| 13 |
+
from .config import Config, load_config
|
| 14 |
from .image_processor import ImageProcessor
|
| 15 |
from .utils import remove_duplicate_boxes, count_panels_inside, extend_boxes_to_image_border
|
| 16 |
|
|
|
|
| 27 |
|
| 28 |
def __init__(self, config: Config = None):
|
| 29 |
"""Initialize the BorderPanelExtractor with optional configuration."""
|
| 30 |
+
self.config = config or load_config()
|
| 31 |
self.output_folder = f'{self.config.output_folder}/border_panel_extractor'
|
| 32 |
os.makedirs(self.output_folder, exist_ok=True)
|
| 33 |
self.PANEL_FILENAME_PATTERN = re.compile(self.config.panel_filename_pattern)
|
|
|
|
| 640 |
|
| 641 |
|
| 642 |
if __name__ == "__main__":
|
| 643 |
+
config = load_config()
|
| 644 |
config.input_path = "test0.jpg"
|
| 645 |
|
| 646 |
import shutil
|
comic_panel_extractor/cli.py
CHANGED
|
@@ -9,7 +9,7 @@ import json
|
|
| 9 |
from typing import Optional, List
|
| 10 |
|
| 11 |
from .main import ComicPanelExtractor
|
| 12 |
-
from .config import Config
|
| 13 |
|
| 14 |
|
| 15 |
class ComicPanelCLI:
|
|
@@ -58,7 +58,7 @@ Examples:
|
|
| 58 |
|
| 59 |
def _load_config(self, args: argparse.Namespace) -> Config:
|
| 60 |
"""Load configuration from file or create from arguments."""
|
| 61 |
-
config =
|
| 62 |
|
| 63 |
# Load from config file if provided
|
| 64 |
if args.config:
|
|
|
|
| 9 |
from typing import Optional, List
|
| 10 |
|
| 11 |
from .main import ComicPanelExtractor
|
| 12 |
+
from .config import Config, load_config
|
| 13 |
|
| 14 |
|
| 15 |
class ComicPanelCLI:
|
|
|
|
| 58 |
|
| 59 |
def _load_config(self, args: argparse.Namespace) -> Config:
|
| 60 |
"""Load configuration from file or create from arguments."""
|
| 61 |
+
config = load_config()
|
| 62 |
|
| 63 |
# Load from config file if provided
|
| 64 |
if args.config:
|
comic_panel_extractor/config.py
CHANGED
|
@@ -28,6 +28,7 @@ class Config:
|
|
| 28 |
YOLO_BASE_MODEL_NAME: str = "yolo11s-seg"
|
| 29 |
YOLO_MODEL_NAME: str = "" # will be derived if empty
|
| 30 |
IMAGE_SOURCE_PATH: str = ""
|
|
|
|
| 31 |
|
| 32 |
# Derived paths
|
| 33 |
yolo_base_model_path: str = ""
|
|
@@ -88,7 +89,8 @@ def load_config(file_path=CONFIG_FILE) -> Config:
|
|
| 88 |
RECREATE_DATASET=to_bool(data.get("RECREATE_DATASET", True)),
|
| 89 |
YOLO_BASE_MODEL_NAME=data.get("YOLO_BASE_MODEL_NAME", "yolo11s-seg"),
|
| 90 |
YOLO_MODEL_NAME=data.get("YOLO_MODEL_NAME", ""), # derived in __post_init__
|
| 91 |
-
IMAGE_SOURCE_PATH=data.get("IMAGE_SOURCE_PATH", "")
|
|
|
|
| 92 |
)
|
| 93 |
|
| 94 |
|
|
|
|
| 28 |
YOLO_BASE_MODEL_NAME: str = "yolo11s-seg"
|
| 29 |
YOLO_MODEL_NAME: str = "" # will be derived if empty
|
| 30 |
IMAGE_SOURCE_PATH: str = ""
|
| 31 |
+
YOLO_MODEL_REMOTE_URL: str = ""
|
| 32 |
|
| 33 |
# Derived paths
|
| 34 |
yolo_base_model_path: str = ""
|
|
|
|
| 89 |
RECREATE_DATASET=to_bool(data.get("RECREATE_DATASET", True)),
|
| 90 |
YOLO_BASE_MODEL_NAME=data.get("YOLO_BASE_MODEL_NAME", "yolo11s-seg"),
|
| 91 |
YOLO_MODEL_NAME=data.get("YOLO_MODEL_NAME", ""), # derived in __post_init__
|
| 92 |
+
IMAGE_SOURCE_PATH=data.get("IMAGE_SOURCE_PATH", ""),
|
| 93 |
+
YOLO_MODEL_REMOTE_URL=data.get("YOLO_MODEL_REMOTE_URL", "")
|
| 94 |
)
|
| 95 |
|
| 96 |
|
comic_panel_extractor/config.toml
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
EPOCH =
|
| 2 |
DEFAULT_IMAGE_SIZE = 640
|
| 3 |
BATCH = 10
|
| 4 |
RESUME_TRAIN = true
|
|
@@ -6,3 +6,4 @@ RECREATE_DATASET = true
|
|
| 6 |
YOLO_BASE_MODEL_NAME = "yolo11s-seg"
|
| 7 |
YOLO_MODEL_NAME = "comic_panel_yolo11s-seg"
|
| 8 |
IMAGE_SOURCE_PATH = "images"
|
|
|
|
|
|
| 1 |
+
EPOCH = 500
|
| 2 |
DEFAULT_IMAGE_SIZE = 640
|
| 3 |
BATCH = 10
|
| 4 |
RESUME_TRAIN = true
|
|
|
|
| 6 |
YOLO_BASE_MODEL_NAME = "yolo11s-seg"
|
| 7 |
YOLO_MODEL_NAME = "comic_panel_yolo11s-seg"
|
| 8 |
IMAGE_SOURCE_PATH = "images"
|
| 9 |
+
YOLO_MODEL_REMOTE_URL = "https://huggingface.co/mosesb/best-comic-panel-detection/resolve/main/best.pt"
|
comic_panel_extractor/create_dataset.py
CHANGED
|
@@ -4,7 +4,7 @@ import random
|
|
| 4 |
from pathlib import Path
|
| 5 |
from dotenv import load_dotenv
|
| 6 |
from tqdm import tqdm
|
| 7 |
-
from .config import load_config
|
| 8 |
|
| 9 |
load_dotenv()
|
| 10 |
config = load_config()
|
|
|
|
| 4 |
from pathlib import Path
|
| 5 |
from dotenv import load_dotenv
|
| 6 |
from tqdm import tqdm
|
| 7 |
+
from .config import Config, load_config
|
| 8 |
|
| 9 |
load_dotenv()
|
| 10 |
config = load_config()
|
comic_panel_extractor/extractor_server.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
from fastapi import APIRouter, File, UploadFile, HTTPException
|
| 2 |
from fastapi.responses import FileResponse
|
| 3 |
import os
|
| 4 |
-
from .config import load_config
|
| 5 |
from .main import ComicPanelExtractor
|
| 6 |
import traceback
|
| 7 |
from pathlib import Path
|
|
@@ -76,7 +76,6 @@ async def convert_comic(file: UploadFile = File(...)):
|
|
| 76 |
print("====================================")
|
| 77 |
|
| 78 |
# Extract panels
|
| 79 |
-
config = Config()
|
| 80 |
config.input_path = file_path
|
| 81 |
config.output_folder = specific_output_folder
|
| 82 |
|
|
|
|
| 1 |
from fastapi import APIRouter, File, UploadFile, HTTPException
|
| 2 |
from fastapi.responses import FileResponse
|
| 3 |
import os
|
| 4 |
+
from .config import Config, load_config
|
| 5 |
from .main import ComicPanelExtractor
|
| 6 |
import traceback
|
| 7 |
from pathlib import Path
|
|
|
|
| 76 |
print("====================================")
|
| 77 |
|
| 78 |
# Extract panels
|
|
|
|
| 79 |
config.input_path = file_path
|
| 80 |
config.output_folder = specific_output_folder
|
| 81 |
|
comic_panel_extractor/image_processor.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
from typing import List, Tuple
|
| 2 |
from pathlib import Path
|
| 3 |
-
from .config import Config
|
| 4 |
|
| 5 |
import numpy as np
|
| 6 |
import cv2
|
|
@@ -18,7 +18,7 @@ class ImageProcessor:
|
|
| 18 |
"""Handles image preprocessing operations."""
|
| 19 |
|
| 20 |
def __init__(self, config: Config = None):
|
| 21 |
-
self.config = config or
|
| 22 |
self.index = 0
|
| 23 |
|
| 24 |
def get_output_path(self, output_folder, file_name):
|
|
|
|
| 1 |
from typing import List, Tuple
|
| 2 |
from pathlib import Path
|
| 3 |
+
from .config import Config, load_config
|
| 4 |
|
| 5 |
import numpy as np
|
| 6 |
import cv2
|
|
|
|
| 18 |
"""Handles image preprocessing operations."""
|
| 19 |
|
| 20 |
def __init__(self, config: Config = None):
|
| 21 |
+
self.config = config or load_config()
|
| 22 |
self.index = 0
|
| 23 |
|
| 24 |
def get_output_path(self, output_folder, file_name):
|
comic_panel_extractor/inference.py
CHANGED
|
@@ -2,7 +2,7 @@
|
|
| 2 |
from .yolo_manager import YOLOManager
|
| 3 |
from .utils import get_abs_path, get_image_paths
|
| 4 |
import os
|
| 5 |
-
from .config import load_config
|
| 6 |
|
| 7 |
config = load_config()
|
| 8 |
|
|
|
|
| 2 |
from .yolo_manager import YOLOManager
|
| 3 |
from .utils import get_abs_path, get_image_paths
|
| 4 |
import os
|
| 5 |
+
from .config import Config, load_config
|
| 6 |
|
| 7 |
config = load_config()
|
| 8 |
|
comic_panel_extractor/llm_panel_extractor.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
from .config import Config
|
| 2 |
from ultralytics import YOLO
|
| 3 |
from PIL import Image
|
| 4 |
import cv2
|
|
@@ -14,13 +14,12 @@ class LLMPanelExtractor:
|
|
| 14 |
"""Handles image preprocessing operations."""
|
| 15 |
|
| 16 |
def __init__(self, config: Config = None):
|
| 17 |
-
self.config = config or
|
| 18 |
|
| 19 |
# Check if YOLO model exists; if not, download it to the specified path
|
| 20 |
-
yolo_base_model_path =
|
| 21 |
-
# yolo_base_model_path = f'{self.config.yolo_trained_model_path}'
|
| 22 |
if not os.path.exists(yolo_base_model_path):
|
| 23 |
-
url =
|
| 24 |
print(f"Downloading YOLO model to {yolo_base_model_path}...")
|
| 25 |
response = requests.get(url)
|
| 26 |
response.raise_for_status() # Raise an error if the download fails
|
|
@@ -158,7 +157,7 @@ class LLMPanelExtractor:
|
|
| 158 |
def extract_panel_via_llm(input_image_path, config=None, reset=True):
|
| 159 |
"""Main function to extract panels using various image processing techniques."""
|
| 160 |
# Initialize configuration
|
| 161 |
-
extractor_config = config or
|
| 162 |
extractor_config.org_input_path = input_image_path
|
| 163 |
|
| 164 |
# Clean output folder
|
|
|
|
| 1 |
+
from .config import Config, load_config
|
| 2 |
from ultralytics import YOLO
|
| 3 |
from PIL import Image
|
| 4 |
import cv2
|
|
|
|
| 14 |
"""Handles image preprocessing operations."""
|
| 15 |
|
| 16 |
def __init__(self, config: Config = None):
|
| 17 |
+
self.config = config or load_config()
|
| 18 |
|
| 19 |
# Check if YOLO model exists; if not, download it to the specified path
|
| 20 |
+
yolo_base_model_path = self.config.yolo_trained_model_path
|
|
|
|
| 21 |
if not os.path.exists(yolo_base_model_path):
|
| 22 |
+
url = self.config.YOLO_MODEL_REMOTE_URL
|
| 23 |
print(f"Downloading YOLO model to {yolo_base_model_path}...")
|
| 24 |
response = requests.get(url)
|
| 25 |
response.raise_for_status() # Raise an error if the download fails
|
|
|
|
| 157 |
def extract_panel_via_llm(input_image_path, config=None, reset=True):
|
| 158 |
"""Main function to extract panels using various image processing techniques."""
|
| 159 |
# Initialize configuration
|
| 160 |
+
extractor_config = config or load_config()
|
| 161 |
extractor_config.org_input_path = input_image_path
|
| 162 |
|
| 163 |
# Clean output folder
|
comic_panel_extractor/main.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
# from .text_detector import TextDetector
|
| 2 |
-
from .config import Config
|
| 3 |
from .image_processor import ImageProcessor
|
| 4 |
from .panel_extractor import PanelData
|
| 5 |
from .panel_extractor import PanelExtractor
|
|
|
|
| 1 |
# from .text_detector import TextDetector
|
| 2 |
+
from .config import Config, load_config
|
| 3 |
from .image_processor import ImageProcessor
|
| 4 |
from .panel_extractor import PanelData
|
| 5 |
from .panel_extractor import PanelExtractor
|
comic_panel_extractor/panel_extractor.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
from typing import List, Tuple
|
| 2 |
-
from .config import Config
|
| 3 |
|
| 4 |
import numpy as np
|
| 5 |
import cv2
|
|
|
|
| 1 |
from typing import List, Tuple
|
| 2 |
+
from .config import Config, load_config
|
| 3 |
|
| 4 |
import numpy as np
|
| 5 |
import cv2
|
comic_panel_extractor/server.py
CHANGED
|
@@ -4,7 +4,7 @@ from fastapi.middleware.cors import CORSMiddleware
|
|
| 4 |
from .extractor_server import app as extractor_app, delete_folder_if_old_or_empty, output_folder
|
| 5 |
from .annorator_server import app as annotator_app
|
| 6 |
import os, json
|
| 7 |
-
from .config import load_config
|
| 8 |
|
| 9 |
from fastapi import Request
|
| 10 |
from fastapi.responses import HTMLResponse
|
|
|
|
| 4 |
from .extractor_server import app as extractor_app, delete_folder_if_old_or_empty, output_folder
|
| 5 |
from .annorator_server import app as annotator_app
|
| 6 |
import os, json
|
| 7 |
+
from .config import Config, load_config
|
| 8 |
|
| 9 |
from fastapi import Request
|
| 10 |
from fastapi.responses import HTMLResponse
|
comic_panel_extractor/static/annotator.html
CHANGED
|
@@ -1211,7 +1211,6 @@
|
|
| 1211 |
document.getElementById('resetModalBtn').addEventListener('click', async () => {
|
| 1212 |
if (confirm('Are you sure you want to reset the model? This action cannot be undone.')) {
|
| 1213 |
try {
|
| 1214 |
-
this.openXterm();
|
| 1215 |
const response = await fetch('/api/annotate/model_reset', { method: 'POST' });
|
| 1216 |
if (!response.ok) {
|
| 1217 |
throw new Error(`Server error: ${response.status}`);
|
|
|
|
| 1211 |
document.getElementById('resetModalBtn').addEventListener('click', async () => {
|
| 1212 |
if (confirm('Are you sure you want to reset the model? This action cannot be undone.')) {
|
| 1213 |
try {
|
|
|
|
| 1214 |
const response = await fetch('/api/annotate/model_reset', { method: 'POST' });
|
| 1215 |
if (!response.ok) {
|
| 1216 |
throw new Error(`Server error: ${response.status}`);
|
comic_panel_extractor/text_detector.py
CHANGED
|
@@ -5,7 +5,7 @@ from typing import List, Optional
|
|
| 5 |
from dataclasses import dataclass
|
| 6 |
import numpy as np
|
| 7 |
|
| 8 |
-
from .config import Config, get_text_cood_file_path
|
| 9 |
|
| 10 |
@dataclass
|
| 11 |
class TextDetection:
|
|
|
|
| 5 |
from dataclasses import dataclass
|
| 6 |
import numpy as np
|
| 7 |
|
| 8 |
+
from .config import Config, load_config, get_text_cood_file_path
|
| 9 |
|
| 10 |
@dataclass
|
| 11 |
class TextDetection:
|
comic_panel_extractor/train.py
CHANGED
|
@@ -2,7 +2,7 @@
|
|
| 2 |
from .yolo_manager import YOLOManager
|
| 3 |
from .utils import get_abs_path, backup_file
|
| 4 |
import os
|
| 5 |
-
from .config import load_config
|
| 6 |
import yaml
|
| 7 |
import os
|
| 8 |
from pathlib import Path
|
|
|
|
| 2 |
from .yolo_manager import YOLOManager
|
| 3 |
from .utils import get_abs_path, backup_file
|
| 4 |
import os
|
| 5 |
+
from .config import Config, load_config
|
| 6 |
import yaml
|
| 7 |
import os
|
| 8 |
from pathlib import Path
|
comic_panel_extractor/utils.py
CHANGED
|
@@ -7,7 +7,7 @@ import os
|
|
| 7 |
import shutil
|
| 8 |
from glob import glob
|
| 9 |
from typing import List, Union
|
| 10 |
-
from .config import load_config
|
| 11 |
from shapely.geometry import Polygon
|
| 12 |
|
| 13 |
config = load_config()
|
|
|
|
| 7 |
import shutil
|
| 8 |
from glob import glob
|
| 9 |
from typing import List, Union
|
| 10 |
+
from .config import Config, load_config
|
| 11 |
from shapely.geometry import Polygon
|
| 12 |
|
| 13 |
config = load_config()
|
comic_panel_extractor/yolo_manager.py
CHANGED
|
@@ -4,7 +4,7 @@ import shutil
|
|
| 4 |
from glob import glob
|
| 5 |
from typing import List, Union
|
| 6 |
from . import utils
|
| 7 |
-
from .config import load_config
|
| 8 |
config = load_config()
|
| 9 |
|
| 10 |
os.environ["TORCH_USE_CUDA_DSA"] = "1"
|
|
@@ -56,7 +56,6 @@ import cv2
|
|
| 56 |
from ultralytics import YOLO
|
| 57 |
from typing import List, Optional, Dict, Any
|
| 58 |
from .utils import get_abs_path, clean_directory
|
| 59 |
-
from .config import Config
|
| 60 |
from dotenv import load_dotenv
|
| 61 |
load_dotenv()
|
| 62 |
|
|
|
|
| 4 |
from glob import glob
|
| 5 |
from typing import List, Union
|
| 6 |
from . import utils
|
| 7 |
+
from .config import Config, load_config
|
| 8 |
config = load_config()
|
| 9 |
|
| 10 |
os.environ["TORCH_USE_CUDA_DSA"] = "1"
|
|
|
|
| 56 |
from ultralytics import YOLO
|
| 57 |
from typing import List, Optional, Dict, Any
|
| 58 |
from .utils import get_abs_path, clean_directory
|
|
|
|
| 59 |
from dotenv import load_dotenv
|
| 60 |
load_dotenv()
|
| 61 |
|