diff --git a/README.md b/README.md index a3ae7ee..a7d91a6 100644 --- a/README.md +++ b/README.md @@ -5,9 +5,9 @@ Codes for paper **Automatic Knee Osteoarthritis Diagnosis from Plain Radiographs # Disclaimer -**This branch is made only for inference purposes. Re-training is possible only in the master branch!!!** +**This branch is only for inference purposes. Re-training is possible only in the master branch!!!** -### Running the backend server +### Running the software This code requires the fresh-most docker and docker compose installed. Execute `sh deploy.sh cpu` to deploy the app on CPU. If you have installed nvidia-docker, @@ -15,8 +15,11 @@ you can also deploy on GPU. The inference is 3 times faster on GPU. To deploy on Be careful, this app carries all the dependencies and weighs around 10GB in total. +# Technical documentation + ## License This code is freely available only for research purposes. Commercial use is not allowed by any means. +The provided software is not cleared for diagnostic purposes. ## How to cite ``` diff --git a/docker/UIDockerfile b/docker/UIDockerfile index 2a8f740..a043017 100644 --- a/docker/UIDockerfile +++ b/docker/UIDockerfile @@ -1,7 +1,10 @@ FROM node:10 -ARG $DEPLOY_PORT -ENV REACT_APP_BROKER_PORT $DEPLOY_PORT +ARG REACT_APP_BROKER_PORT +ARG REACT_APP_BROKER_ADDR + +ENV REACT_APP_BROKER_PORT $REACT_APP_BROKER_PORT +ENV REACT_APP_BROKER_ADDR $REACT_APP_BROKER_ADDR WORKDIR /usr/src/app COPY . . diff --git a/docker/docker-compose-cpu.yml b/docker/docker-compose-cpu.yml index c406611..ce08312 100644 --- a/docker/docker-compose-cpu.yml +++ b/docker/docker-compose-cpu.yml @@ -4,6 +4,7 @@ services: image: "miptmloulu/kneel:cpu" ports: - "5000:5000" + container_name: kneel volumes: - type: bind source: ../snapshots_release_kneel # The snapshots are stored in the root directory @@ -23,6 +24,7 @@ services: image: "miptmloulu/deepknee:cpu" ports: - "5001:5001" + container_name: deepknee volumes: - type: bind source: ../snapshots_knee_grading/ # The snapshots are stored in the root directory @@ -37,3 +39,35 @@ services: "--snapshots_path", "/snapshots/", "--device", "cpu", "--deploy", "True", "--port", "5001", "--logs", "/logs/deepknee-cpu.log"] + backend-broker: + depends_on: + - kneel + - deepknee-backend + build: + context: ../deepknee-backend-broker + dockerfile: ../docker/BrokerDockerfile + container_name: backend-broker + ports: + - "5002:5002" + environment: + - DEPLOY_HOST=0.0.0.0 + - DEPLOY_PORT=5002 + - KNEEL_ADDR=http://kneel + - KNEEL_PORT=5000 + - DEEPKNEE_ADDR=http://deepknee-backend + - DEEPKNEE_PORT=5001 + entrypoint: ["node", "/usr/src/app/server.js"] + ui: + depends_on: + - kneel + - deepknee-backend + - backend-broker + build: + context: ../deepknee-frontend + dockerfile: ../docker/UIDockerfile + args: + - REACT_APP_BROKER_PORT=5002 + container_name: ui + ports: + - "5003:5003" + entrypoint: ["serve", "-l", "5003", "-s", "/usr/src/app/build"] diff --git a/docker/docker-compose-gpu.yml b/docker/docker-compose-gpu.yml index 5d92c2e..649ba49 100644 --- a/docker/docker-compose-gpu.yml +++ b/docker/docker-compose-gpu.yml @@ -5,6 +5,7 @@ services: image: "miptmloulu/kneel:gpu" ports: - "5000:5000" + container_name: kneel volumes: - type: bind source: ../snapshots_release_kneel # The snapshots are stored in the root directory @@ -22,9 +23,10 @@ services: runtime: nvidia depends_on: - kneel - image: "miptmloulu/kneel:gpu" + image: "miptmloulu/deepknee:gpu" ports: - "5001:5001" + container_name: deepknee volumes: - type: bind source: ../snapshots_knee_grading/ # The snapshots are stored in the root directory @@ -36,9 +38,9 @@ services: environment: - KNEEL_ADDR=http://kneel:5000 entrypoint: ["python", "-m", "ouludeepknee.inference.app", - "--snapshots_path", "/snapshots/", - "--device", "cuda", "--deploy", "True", - "--port", "5001", "deploy_addr", "0.0.0.0", + "--snapshots_path", "/snapshots/", + "--device", "cuda", "--deploy", "True", + "--port", "5001", "--deploy_addr", "0.0.0.0", "--logs", "/logs/deepknee-gpu.log"] backend-broker: depends_on: @@ -47,15 +49,16 @@ services: build: context: ../deepknee-backend-broker dockerfile: ../docker/BrokerDockerfile + container_name: backend-broker ports: - "5002:5002" environment: + - DEPLOY_HOST=0.0.0.0 + - DEPLOY_PORT=5002 - KNEEL_ADDR=http://kneel - KNEEL_PORT=5000 - DEEPKNEE_ADDR=http://deepknee-backend - DEEPKNEE_PORT=5001 - - DEPLOY_HOST=0.0.0.0 - - DEPLOY_PORT=5002 entrypoint: ["node", "/usr/src/app/server.js"] ui: depends_on: @@ -66,7 +69,8 @@ services: context: ../deepknee-frontend dockerfile: ../docker/UIDockerfile args: - - DEPLOY_PORT=5002 + - REACT_APP_BROKER_PORT=5002 + container_name: ui ports: - "5003:5003" entrypoint: ["serve", "-l", "5003", "-s", "/usr/src/app/build"] diff --git a/rebuild_docker_images.sh b/rebuild_docker_images.sh new file mode 100644 index 0000000..8df38ed --- /dev/null +++ b/rebuild_docker_images.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +# DeepKnee REST microservice images +docker build -t miptmloulu/deepknee:gpu -f docker/Dockerfile.gpu . +docker build -t miptmloulu/deepknee:cpu -f docker/Dockerfile.cpu . +docker push miptmloulu/deepknee:cpu && docker push miptmloulu/deepknee:gpu + +# Frontend and Backend broker \ No newline at end of file diff --git a/run_experiments_antony.sh b/run_experiments_antony.sh deleted file mode 100755 index 711b513..0000000 --- a/run_experiments_antony.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env bash - - -# Activating the environment -#source /media/lext/FAST/pytorch_3_6_env/bin/activate - -# Training parameters -export DROPOUT=0.2 -export WD=1e-4 -export BATCH_SIZE=64 -export BATCH_SIZE_VAL=64 -export BASE_WIDTH=64 -export LR=1e-4 - -export LOGS_FLD="training_logs" -export N_EPOCH=500 -export N_BATCHES=500 -export BOOTRSTRAP=15 - - -mkdir -p $LOGS_FLD -cd antony_codes - - -export SEED=42 -export SUFFIX="${SEED}_${BATCH_SIZE}_antony" -python -u train.py --use_visdom True --experiment "[Joseph Antony net]" --n_epoch $N_EPOCH --drop $DROPOUT --wd $WD --lr $LR --lr_drop 101 --bs $BATCH_SIZE --val_bs $BATCH_SIZE_VAL --lr_min 1e-6 --base_width $BASE_WIDTH --seed $SEED --n_batches $N_BATCHES --bootstrap $BOOTRSTRAP #> ../$LOGS_FLD/$SUFFIX.txt 2>&1 -echo "Started training..." -sleep 3s - diff --git a/run_experiments_own.sh b/run_experiments_own.sh deleted file mode 100755 index 81d488b..0000000 --- a/run_experiments_own.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env bash - - -# Activating the environment -#source /media/lext/FAST/pytorch_3_6_env/bin/activate - -# Training parameters -export DROPOUT=0.2 -export WD=1e-4 -export BATCH_SIZE=64 -export BATCH_SIZE_VAL=64 -export BASE_WIDTH=64 -export LR=1e-2 - -export LOGS_FLD="training_logs" -export N_EPOCH=100 -export N_BATCHES=500 -export BOOTRSTRAP=15 - - -mkdir -p $LOGS_FLD -cd own_codes - - -export SEED=21 -export SUFFIX="${SEED}_${BASE_WIDTH}_${BATCH_SIZE}" -python -u train.py --use_visdom True --experiment "[S21,BW64]" --n_epoch $N_EPOCH --drop $DROPOUT --wd $WD --lr $LR --lr_drop 101 --bs $BATCH_SIZE --val_bs $BATCH_SIZE_VAL --lr_min 1e-6 --base_width $BASE_WIDTH --seed $SEED --n_batches $N_BATCHES --bootstrap $BOOTRSTRAP > ../$LOGS_FLD/$SUFFIX.txt 2>&1 & -echo "Started training..." -sleep 3s - -export SEED=42 -export SUFFIX="${SEED}_${BASE_WIDTH}_${BATCH_SIZE}" -python -u train.py --use_visdom True --experiment "[S42,BW64]" --n_epoch $N_EPOCH --drop $DROPOUT --wd $WD --lr $LR --lr_drop 101 --bs $BATCH_SIZE --val_bs $BATCH_SIZE_VAL --lr_min 1e-6 --base_width $BASE_WIDTH --seed $SEED --n_batches $N_BATCHES --bootstrap $BOOTRSTRAP > ../$LOGS_FLD/$SUFFIX.txt 2>&1 & -echo "Started training..." -sleep 3s - -export SEED=84 -export SUFFIX="${SEED}_${BASE_WIDTH}_${BATCH_SIZE}" -python -u train.py --use_visdom True --experiment "[S84,BW64]" --n_epoch $N_EPOCH --drop $DROPOUT --wd $WD --lr $LR --lr_drop 101 --bs $BATCH_SIZE --val_bs $BATCH_SIZE_VAL --lr_min 1e-6 --base_width $BASE_WIDTH --seed $SEED --n_batches $N_BATCHES --bootstrap $BOOTRSTRAP > ../$LOGS_FLD/$SUFFIX.txt 2>&1 & -echo "Started training..." diff --git a/run_experiments_resnet.sh b/run_experiments_resnet.sh deleted file mode 100755 index 921ad36..0000000 --- a/run_experiments_resnet.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env bash - - -# Activating the environment -#source /media/lext/FAST/pytorch_3_6_env/bin/activate - -# Training parameters -export DROPOUT=0.5 -export WD=1e-4 -export BATCH_SIZE=64 -export BATCH_SIZE_VAL=64 -export BASE_WIDTH=64 -export LR=1e-3 - -export LOGS_FLD="training_logs" -export N_EPOCH=100 -export N_BATCHES=300 -export BOOTRSTRAP=15 - - -mkdir -p $LOGS_FLD -cd resnet_codes - - -export SEED=42 -export SUFFIX="${SEED}_${BATCH_SIZE}_resnet" -python -u train.py --use_visdom True --experiment "[ResNet-34]" --n_epoch $N_EPOCH --drop $DROPOUT --wd $WD --lr $LR --lr_drop 101 --bs $BATCH_SIZE --val_bs $BATCH_SIZE_VAL --lr_min 1e-6 --base_width $BASE_WIDTH --seed $SEED --n_batches $N_BATCHES --bootstrap $BOOTRSTRAP #> ../$LOGS_FLD/$SUFFIX.txt 2>&1 -echo "Started training..." -sleep 3s -