Предварительно нужно создать файл .env в корне проекта по шаблону .env.example
Далее надо освободить порт 5432, используемый обычно Postgres, после чего запускаем контейнер:
docker network create shared-api-network
docker-compose up -d --build
docker compose -f docker-compose-model.yml up -d --build --force-recreate
Глобально в проекте используются четыре разные составные модели:
Возможны конфигурации
Задается установкой в
.envML__IS_CUT_LIGHT_WEIGHT=True
Задается установкой в
.envML__IS_CUT_LIGHT_WEIGHT=False
Максимальный режим: 2 x 24 Гб GPU. Например, 2 x Tesla A5000
Облегченный режим: 1 x 24 Гб GPU. Например, 1 x Tesla A5000. Допускается использование облегченных моделей обрезки
За неимением времени на разработку в проекте используется requirements.txt для запуска ML части. В планах его перенести в pyproject.toml.
Чтобы ml заработал нужно скачать веса. Для этого скачиваем архив с весами (ссылку можно попросить у @KOTOBOPOT). Его содержимое распаковываем в папку ML__WEIGHTS_PATH (переменная в .env). Указанные операции можно сделать при помощи следующих команд:
wget /link/to/weights/archieve -O weights.zip \
&& source .env \
&& mkdir $ML__WEIGHTS_PATH \
&& unzip weights.zip -d $ML__WEIGHTS_PATH\
&& rm weights.zip
Classes for working has folowing view:
Clothes Preprocessing: app/pkg/ml/try_on/preprocessing/aggregator.py - class: ClothProcessor. method: consistent_forward(image_bytes)
Clothes processing launches when user has uploded cloth image
Human Preprocessing: app/pkg/ml/try_on/preprocessing/aggregator.py - class: HumanProcessor. method: consistent_forward(image_bytes)
Human processing launches when user has uploded human image
Try on: app/pkg/ml/try_on/lady_vton.py class: TryOnAggregator. method: __call__(dict)
Try on processing launches when user has requested to try on. Input dict format is:
{
"image_human_orig":io.BytesIO, # - image with human
"parsed_human":io.BytesIO, # - image with parsed human.
"keypoints_json":io.BytesIO # human keypoints json
"cloth":io.BytesIO # cloth (without background) image bytes
"category":str, # one of ['dresses', 'upper_body','lower_body']
}
Keys from dict above corresponds with output keys from 1) and 2) methods.
Formats for recsys:
outfits format: [ {"user_id":int/str, "outfit_id":int/str, "clothes": [cloth_id, ...] }, ... ]
cloth_id_to_list format - dict[cloth_id] -> list (cloth tensor)
Key "tensor" can be caught from autoset system.
P.S. It's recommended to init instances once in each class above. Initialization process can require more time, than image processing.
docker build -t dev_virt_ward:latest -f docker/model/Dockerfile_dev .
docker run -id --rm --gpus all -v .:/usr/src/app/ --name virt_ward_dev dev_virt_ward:latest
docker compose -f docker-compose-dev.yml up -d --build --force-recreate
Python
58.0%
Jupyter Notebook
37.8%
Cuda
2.4%
C++
1.5%
Предварительно нужно создать файл .env в корне проекта по шаблону .env.example
Далее надо освободить порт 5432, используемый обычно Postgres, после чего запускаем контейнер:
docker network create shared-api-network
docker-compose up -d --build
docker compose -f docker-compose-model.yml up -d --build --force-recreate
Глобально в проекте используются четыре разные составные модели:
Возможны конфигурации
Задается установкой в
.envML__IS_CUT_LIGHT_WEIGHT=True
Задается установкой в
.envML__IS_CUT_LIGHT_WEIGHT=False
Максимальный режим: 2 x 24 Гб GPU. Например, 2 x Tesla A5000
Облегченный режим: 1 x 24 Гб GPU. Например, 1 x Tesla A5000. Допускается использование облегченных моделей обрезки
За неимением времени на разработку в проекте используется requirements.txt для запуска ML части. В планах его перенести в pyproject.toml.
Чтобы ml заработал нужно скачать веса. Для этого скачиваем архив с весами (ссылку можно попросить у @KOTOBOPOT). Его содержимое распаковываем в папку ML__WEIGHTS_PATH (переменная в .env). Указанные операции можно сделать при помощи следующих команд:
wget /link/to/weights/archieve -O weights.zip \
&& source .env \
&& mkdir $ML__WEIGHTS_PATH \
&& unzip weights.zip -d $ML__WEIGHTS_PATH\
&& rm weights.zip
Classes for working has folowing view:
Clothes Preprocessing: app/pkg/ml/try_on/preprocessing/aggregator.py - class: ClothProcessor. method: consistent_forward(image_bytes)
Clothes processing launches when user has uploded cloth image
Human Preprocessing: app/pkg/ml/try_on/preprocessing/aggregator.py - class: HumanProcessor. method: consistent_forward(image_bytes)
Human processing launches when user has uploded human image
Try on: app/pkg/ml/try_on/lady_vton.py class: TryOnAggregator. method: __call__(dict)
Try on processing launches when user has requested to try on. Input dict format is:
{
"image_human_orig":io.BytesIO, # - image with human
"parsed_human":io.BytesIO, # - image with parsed human.
"keypoints_json":io.BytesIO # human keypoints json
"cloth":io.BytesIO # cloth (without background) image bytes
"category":str, # one of ['dresses', 'upper_body','lower_body']
}
Keys from dict above corresponds with output keys from 1) and 2) methods.
Formats for recsys:
outfits format: [ {"user_id":int/str, "outfit_id":int/str, "clothes": [cloth_id, ...] }, ... ]
cloth_id_to_list format - dict[cloth_id] -> list (cloth tensor)
Key "tensor" can be caught from autoset system.
P.S. It's recommended to init instances once in each class above. Initialization process can require more time, than image processing.
docker build -t dev_virt_ward:latest -f docker/model/Dockerfile_dev .
docker run -id --rm --gpus all -v .:/usr/src/app/ --name virt_ward_dev dev_virt_ward:latest
docker compose -f docker-compose-dev.yml up -d --build --force-recreate
Python
58.0%
Jupyter Notebook
37.8%
Cuda
2.4%
C++
1.5%