教學
PyTorch
YOLOv3
- 在Docker上使用PyTorch-YOLOv3
Image Not Showing Possible ReasonsLearn More →
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
- 軟體版本:
Software | Version |
---|---|
Ubunut | 18.04 |
Docker | 18.09.3 |
Nividia Driver | 410.104 |
CUDA | 10.0 |
Run the commands below to create a docker container,
replacing{user_name}
with your user name(directory)
replacing{port}
with the external port you wish to use.
replacing{your_container_name}
with your container name
nvidia-docker run --ipc=host -it [OPTION] nvcr.io/nvidia/pytorch:19.02-py3
-v /mnt/MIL/{user_name}:/workspace :掛載本機目錄至/workspace
-p {port}:8888 :指定容器對外Port(若不使用Jupyter notebook可不使用)
--name={your_container_name} :為容器指定一個名稱
apt-get update
apt-get install sudo
sudo apt install python3-pip
pip install --upgrade pip
git clone https://github.com/eriklindernoren/PyTorch-YOLOv3
cd PyTorch-YOLOv3/
In your host browser, turn on the jupyter notebook interface via copying and pasting the URLs on the message, but replacing the ip such as the example (69886b134214 or 127.0.0.1) with 120.113.173.215.
jupyter notebook --allow-root --no-browser --ip=0.0.0.0
使用jupyter notebook開啟requirement.txt,並將tensorflow更新為以下代碼:
tensorflow-gpu==1.14.0
conda update -n base -c defaults conda
原因:PackagesNotFoundError: The following packages are not available from current channels:
conda config --append channels conda-forge
使用conda安装requirement.txt指定的依赖包
while read requirement; do conda install --yes $requirement || pip install $requirement; done < requirements.txt
cd weights/
bash download_weights.sh
cd ..
cd data/
bash get_coco_dataset.sh
cd ..
pip install --upgrade Pillow==6.2.1
import torch
torch.cuda.is_available()
true
若最後輸出false
請檢查環境與GPU驅動版本
python3 test.py --weights_path weights/yolov3.weights
python3 detect.py --image_folder data/samples/
python3 train.py --data_config config/coco.data --pretrained_weights weights/darknet53.conv.74
將tornado由6.x降版
原因:jupyter notebook connecting to kernel problem
pip install --upgrade tornado==4.5.3
使用此方法可執行detected檔案(不在github中,自行在jupyter notebook建立)
開始執行後,安裝環境時若出現
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-ejg24h9w/matplotlib/
他是用anaconda 所以要用conda升級python
python3 --version
conda update python //會導致conda失效
https://github.com/conda/conda/issues/8920
pip install --upgrade setuptools
sudo apt-get install libpcap-dev libpq-dev
sudo apt install software-properties-common