Spaces:
Sleeping
Sleeping
cuda and docker updates
Browse files- Dockerfile +8 -2
- src/htr_pipeline/models.py +1 -1
- src/htr_pipeline/utils/filter_segmask.py +1 -1
Dockerfile
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
FROM
|
2 |
|
3 |
ARG DEBIAN_FRONTEND=noninteractive
|
4 |
ENV PYTHONUNBUFFERED=1
|
@@ -22,6 +22,12 @@ COPY ./requirements.txt /code/requirements.txt
|
|
22 |
|
23 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
# Set up a new user named "user" with user ID 1000
|
26 |
RUN useradd -m -u 1000 user
|
27 |
|
@@ -45,4 +51,4 @@ WORKDIR $HOME/app
|
|
45 |
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
46 |
COPY --chown=user . $HOME/app
|
47 |
|
48 |
-
CMD ["python3", "app.py"]
|
|
|
1 |
+
FROM nvidia/cuda:11.8.0-cudnn8-devel-ubuntu20.04
|
2 |
|
3 |
ARG DEBIAN_FRONTEND=noninteractive
|
4 |
ENV PYTHONUNBUFFERED=1
|
|
|
22 |
|
23 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
24 |
|
25 |
+
RUN mim install mmdet
|
26 |
+
RUN mim install mmocr
|
27 |
+
RUN mim install mmcv==2.0.1
|
28 |
+
RUN mim install mmengine
|
29 |
+
|
30 |
+
|
31 |
# Set up a new user named "user" with user ID 1000
|
32 |
RUN useradd -m -u 1000 user
|
33 |
|
|
|
51 |
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
52 |
COPY --chown=user . $HOME/app
|
53 |
|
54 |
+
CMD ["python3", "app.py"]
|
src/htr_pipeline/models.py
CHANGED
@@ -10,7 +10,7 @@ from mmocr.apis import TextRecInferencer
|
|
10 |
|
11 |
class HtrModels:
|
12 |
def __init__(self, local_run=False):
|
13 |
-
self.device = torch.device("cuda
|
14 |
|
15 |
model_folder = "./models"
|
16 |
self.region_config = f"{model_folder}/RmtDet_regions/rtmdet_m_textregions_2_concat.py"
|
|
|
10 |
|
11 |
class HtrModels:
|
12 |
def __init__(self, local_run=False):
|
13 |
+
self.device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
14 |
|
15 |
model_folder = "./models"
|
16 |
self.region_config = f"{model_folder}/RmtDet_regions/rtmdet_m_textregions_2_concat.py"
|
src/htr_pipeline/utils/filter_segmask.py
CHANGED
@@ -88,7 +88,7 @@ class FilterSegMask:
|
|
88 |
yB = min(box_a[1] + box_a[3], box_b[1] + box_b[3]) # min y1
|
89 |
|
90 |
box_a_area = box_a[2] * box_a[3]
|
91 |
-
box_b_area = box_b[2] * box_b[3]
|
92 |
|
93 |
intersection_area = max(0, xB - xA + 1) * max(0, yB - yA + 1)
|
94 |
containment = intersection_area / box_a_area if box_a_area > 0 else 0
|
|
|
88 |
yB = min(box_a[1] + box_a[3], box_b[1] + box_b[3]) # min y1
|
89 |
|
90 |
box_a_area = box_a[2] * box_a[3]
|
91 |
+
# box_b_area = box_b[2] * box_b[3]
|
92 |
|
93 |
intersection_area = max(0, xB - xA + 1) * max(0, yB - yA + 1)
|
94 |
containment = intersection_area / box_a_area if box_a_area > 0 else 0
|