-
AI Drone Edu인공지능(AI)/Intel 2019. 8. 8. 17:59
< prerequisite >
conda deactivate
.bashrc edit
mkdir AI_Drone
cd AI_Drone
git clone https://github.com/ikelee77/inference_python.git
git clone https://github.com/AINukeHere/DroneFestival_U.git
( if pyqt5 is not installed, install it especially Dongmyung U.)
check
sudo apt-get install python3-pyqt5
install
sudo apt-get install python3-pyqt5
< training >
( cifar10 sample training )
cd ~/caffe
./data/cifar10/get_cifar10.sh
-> downloard into ./data/cifar10 dir
create lmdb
./examples/cifar10/create_cifar10.sh
-> generating lmdb in ./examples/cifar10 *.lmdb, *.lmdb, mean.binaryproto
(training)
edit : cifar10_full_solver.prototxt
-> snapshot_format: BINARYPROTO
./examples/cifar10/train_quick.sh
( cifar10 sample inference )
needed files : *.caffemodel, *.prototxt
cp cifar10_full_iter_70000.caffemodel cifar.caffemodel
cp cifar10_full_train_test.prototxt cifar.prototxt
rename : cifar.caffemodel, cifar.prototxt
copy into ~/my_model
edit cifar.prototxt
name: "cifar"
delete
add layer(맨 위, 이름 바로 아래)
delete(매 뒤)
맨 뒤줄에 추가
layer {
name: "prob"
type: "Softmax"
bottom: "ip1"
top: "prob"
}cd /opt/intel/openvino/deployment_tools/model_optimizer/
sudo python3 mo/front/caffe/proto/generate_caffe_pb2.py --input_proto /home/intel/caffe/src/caffe/proto/caffe.protocaffe_pb2.py file is generated.
(optimize)
python3 mo.py --input_model ~/my_model/cifar.caffemodel --output_dir ~/my_model
-> generated file into ~/my_model : cifar.bin, cifar.xml, cifar.mappin
<openvino 에러가 나면 필요한 모듈을 pip로 설치하고 다시 시도>
(inference test)
$ cd ~/sample
$ python3 rt_inference.py---------
( image add )
image data conversion into png file
source /opt/intel/openvino/bin/setupvars.sh
cd ~/caffe/examples/cifar10
python3 cifar2png.py-> generated into ~/caffe/data/cifar10
image capture by cam
mkdir /home/intel/caffe/data/cifar10/capture
python3 caphand.pyimage downloard from kaggle (login)
https://www.kaggle.com/alishmanandhar/rock-scissor-paper/version/1
unzip and move to caffe/data/final
cd ~/caffe/examples/cifar10
python3 handmade.py-> converted image saved in caffe/data/cifar10 rock, scissors, paper (resized 32 x 32)
merge images kaggle and capture
createdb
edit createdb.py : add rock, scissors, paper into name array
python3 create.py ; test rate : 16
-> generating lmdb in ./examples/cifar10 *.lmdb, *.lmdb
image_mean 파일 생성
cd ~/caffe/
./build/tools/compute_image_mean -backend=lmdb examples/cifar10/cifar10_train_lmdb examples/cifar10/mean.binaryproto< model optimizing >
copy model file into ~/my_model
and rename cifar.caffemodel
edit
edit cifar.prototxt : --> num_output change 10 or 13 or 16
Caffe용 prptotxt 환경 생성
cd /opt/intel/openvino/deployment_tools/model_optimizer/
$ sudo python3 mo/front/caffe/proto/generate_caffe_pb2.py --input_proto /home/intel/caffe/src/caffe/proto/caffe.proto최적화 진행
python3 mo.py --input_model ~/my_model/cifar.caffemodel --output_dir ~/my_model
-> 3 files are generated
*.xml, *.bin, *.mapping
< inference >
코드 실행
~/my.model/*.xml, *.bin
cd ~/sample
python3 rt_inference.pydrone : setting file
'인공지능(AI) > Intel' 카테고리의 다른 글
2019 인텔 AI 드론 경진대회 (0) 2019.10.09 display driver setting (0) 2019.08.08