This project uses Django REST API and Pythorch. It provides an API that tells you the coordinates when the user takes a picture of billiards. When the user gives the initial placement coordinates of billiards, it provides an API that informs the recommended route.
git clone https://github.com/Carom-Helper/Carom-API-Server.git
cd Carom-API-Server
# git submodule update --init --recursive --remote
git submodule update --init --recursive# For Linux
# FRAME_WORK('furiosa', '0', 'cpu', 'onnx')
cd src
echo '{"FRAME_WORK":"furiosa" ,"HOST_NAME":"118.36.223.138", "PORT_NUM":"7576"}' > settings.json
echo '{json contents}' > secrets.json
cd ..# For Window
# FRAME_WORK('furiosa', '0', 'cpu', 'onnx')
cd src
echo {"FRAME_WORK":"cpu" ,"HOST_NAME":"118.36.223.138", "PORT_NUM":"7576"} > settings.json
echo '{json contents}' > secrets.json
cd ..# example
{"SECRET_KEY":"django-insecure-d*upt!(-*)wA#3^cdc-e9ac3s4s8afd9d4m=_2(!a+2v&@1avs2s4v="}https://pytorch.org/get-started/locally/
conda create -n carom-api python=3.8.2 -y
conda activate carom-api
# GPU - CONDA
conda install pytorch==1.8.0 torchvision==0.9.0 torchaudio==0.8.0 cudatoolkit=11.1 -c pytorch -c conda-forge -y
# CPU - CONDA
# conda install pytorch torchvision torchaudio cpuonly -c pytorch -ypip install -r requirements.txt
# conda install django -y
cd detection/detect/npu_yolov5/utils/box_decode/cbox_decode
python setup.py build_ext --inplace
cd ../../../../../../# Check if the django works well
cd src
python manage.py runserver# Check if the pytorch works well
cd detection/detect
python DetectObjectPipe.py
cd npu_yolov5
python demo.py --calib-data /caromapi/src/media/test --framework furiosa --input /caromapi/src/media/test2/sample.jpg --model /caromapi/src/detection/detect/weights/npu_yolo_ball --no-display- Add USR in Makefile
USR={#ADD Your name (ex - jylee}
PORT_NUM=3213
SRC_NAME=caromapi- Docker build
make buildmake runcd detection/detect/npu_yolov5/utils/box_decode/cbox_decode
python setup.py build_ext --inplace
cd ../../../../../../python clear_migrate.py & python manage.py makemigrations & python manage.py makeviewmigrations & python manage.py migrate & echo import init_setter | python manage.py shell_pluspython clear_migrate.py && python manage.py makemigrations && python manage.py makeviewmigrations && python manage.py migrate && echo "import init_setter" | python manage.py shell_plus# error npu_yolov5/utils/inference_engine.py InferenceEngineFuriosa.__init__
# compile_config change to compiler_config
python manage.py test
python manage.py runserver 0.0.0.0:7576# Ctrl + c
make rm#furiosa compile
# furiosa compile 파일명.onnx -o 파일명.enf
NPU_COMPILER_CONFIG_PATH=compiler_config.yaml furiosa compile weights_i8.onnx -o weights.enf