stephanecharette / DarkMark

Marking up images for use with Darknet.
https://www.ccoderun.ca/darkmark/Summary.html
Other
160 stars 21 forks source link

DarkMark GUI Missing Text in Docker Container #24

Closed lost-robot closed 1 year ago

lost-robot commented 1 year ago

Awesome work!!! ...I have been able to use DarkHelp within a Docker container without any issues. When I launch DarkMark from a running container there is no text in the GUI. Any idea regarding what the cause could be? Thanks!

image Here is the Dockerfile:

# FROM nvidia/cuda:11.7.1-cudnn8-devel-ubuntu18.04
FROM nvidia/cuda:11.7.1-cudnn8-devel-ubuntu22.04 

LABEL maintainer="Name <name@mail.com>"

ARG USER_ID
ARG GROUP_ID

ENV DEBIAN_FRONTEND noninteractive

RUN apt update
RUN apt -y install tzdata
RUN echo "America/Denver" > /etc/timezone
RUN dpkg-reconfigure -f noninteractive tzdata

RUN apt update && apt -y --quiet --no-install-recommends install \
        sudo                    \
        openssl                 \
        git                     \
        pkg-config              \
        libopencv-dev           \
        cmake                   \
        build-essential         \
        libtclap-dev            \
        libmagic-dev            \                                       
        libx11-dev              \
        libfreetype6-dev        \
        libxrandr-dev           \
        libxinerama-dev         \
        libxcursor-dev          \
        libmagic-dev            \
        libpoppler-cpp-dev

RUN useradd -ms /bin/bash user -p "$(openssl passwd -1 password)"
RUN usermod -aG sudo user

# Install Darknet
USER root
RUN groupmod -g $GROUP_ID user && usermod -u $USER_ID user
WORKDIR /home/user
RUN git clone https://github.com/AlexeyAB/darknet.git 

# Edit Makefile parameters and make library
WORKDIR /home/user/darknet
RUN sed -i 's/GPU=0/GPU=1/; s/CUDNN=0/CUDNN=1/; s/OPENCV=0/OPENCV=1/; s/LIBSO=0/LIBSO=1/' Makefile
RUN make 

RUN cp libdarknet.so /usr/local/lib/
RUN cp include/darknet.h /usr/local/include/
RUN ldconfig

# Add location of libcuda.so.1 for darknet lib
ENV LD_LIBRARY_PATH="/usr/local/cuda/compat:${LD_LIBRARY_PATH}" 

# Darkhelp - https://www.ccoderun.ca/DarkHelp/api/Building.html
WORKDIR /home/user
RUN git clone https://github.com/stephanecharette/DarkHelp.git
WORKDIR /home/user/DarkHelp
RUN mkdir build
WORKDIR /home/user/DarkHelp/build
RUN cmake -DCMAKE_BUILD_TYPE=Release ..
RUN make
RUN make package
RUN dpkg -i darkhelp-*.deb

# DarkMark - https://github.com/stephanecharette/DarkMark                               
WORKDIR /home/user
RUN git clone https://github.com/stephanecharette/DarkMark.git
WORKDIR /home/user/DarkMark
RUN mkdir build
WORKDIR /home/user/DarkMark/build
RUN cmake -DCMAKE_BUILD_TYPE=Release ..
RUN make
RUN make package
RUN dpkg -i darkmark*.deb

USER user

# ENV LD_LIBRARY_PATH="/usr/local/cuda/compat:${LD_LIBRARY_PATH}"

WORKDIR /home/user/src/build

Here is the run script:

#! /bin/bash

xhost +si:localuser:root # allow containers to communicate with X server

docker run --rm -it --privileged \
       --env DISPLAY=$DISPLAY \
       --env=LOCAL_USER_ID="$(id -u)" \
       -v /tmp/.X11-unix:/tmp/.X11-unix \
       --gpus all \
       --name=darkmark_container darkmark:latest \

Here is the build script:

#! /bin/bash

docker build -t darkmark --build-arg USER_ID=$(id -u) --build-arg GROUP_ID=$(id -g) .

Start DarkMark command from within the container:

/usr/bin/DarkMark
stephanecharette commented 1 year ago

Yes, I'm guessing you don't have the necessary fonts installed.

See issue #21 and issue #23.

lost-robot commented 1 year ago

Yes, that was indeed the issue. Thanks very much!

...'sudo apt install fonts-liberation' fixed the problem.