動機:若想在 macOS 玩 Xnor.ai samples(C、Python),要如何做呢?!(因為官網只提供 linux-x86_64 線上教學文件)
準備環境:
1.
實作步驟:
1.先到官網(https://ai2go.xnor.ai/home)下載 xnor SDK壓縮檔(sdk_v1.0.0.zip),並 $ unzip 解壓縮
2.再到C samples
0.model_benchmark.sh
1.object_detector.sh
2.classify_image.sh
3.detect_print_object.sh
4.segmentation_image.sh
5.json_dump_object.sh
4.再到Python samples 撰寫 bash script 執行其Python samples,如下:
a) 0.model_benchmark.sh
結果如下圖
b) 1.image_bounding.sh
結果如下圖
c) 2.sort_images.sh
結果如下圖
心得:
準備環境:
1.
實作步驟:
1.先到官網(https://ai2go.xnor.ai/home)下載 xnor SDK壓縮檔(sdk_v1.0.0.zip),並 $ unzip 解壓縮
2.再到C samples
0.model_benchmark.sh
./build/model_benchmark
1.object_detector.sh
cp ../../../lib/macos/person-pet-vehicle-detector/libxnornet.dylib ./build/
./build/object_detector
open ../../test-images/dog.jpg
2.classify_image.sh
cp ../../../lib/macos/facial-expression-classifier/libxnornet.dylib ./build/
./build/classify_image_file ../../test-images/happy.jpg
open ../../test-images/happy.jpg
3.detect_print_object.sh
cp ../../../lib/macos/person-pet-vehicle-detector/libxnornet.dylib ./build/
./build/detect_and_print_objects_in_image ../../test-images/dog.jpg
open ../../test-images/dog.jpg
4.segmentation_image.sh
cp ../../../lib/macos/person-segmenter/libxnornet.dylib ./build/
./build/segmentation_mask_of_image_file_to_file ../../test-images/person.jpg
open ../../test-images/person.jpg
open ../../test-images/person.person.tga
5.json_dump_object.sh
cp ../../../lib/macos/person-pet-vehicle-detector/libxnornet.dylib ./build/
./build/json_dump_objects_in_image ../../test-images/dog.jpg
open ../../test-images/dog.jpg
結果如下圖4.再到Python samples 撰寫 bash script 執行其Python samples,如下:
a) 0.model_benchmark.sh
python3 model_benchmark.py
結果如下圖
b) 1.image_bounding.sh
python3 -m pip uninstall -y xnornet
python3 -m pip install ../../../lib/macos/person-pet-vehicle-detector/xnornet-1.0-cp35-abi3-macosx_10_13_x86_64.whl
python3 static_image_bounding_box.py ../../test-images/vehicle.jpg
open static_image_bounding_box_output.png
結果如下圖
c) 2.sort_images.sh
python3 -m pip uninstall -y xnornet
python3 -m pip install ../../../lib/macos/person-pet-vehicle-detector/xnornet-1.0-cp35-abi3-macosx_10_13_x86_64.whl
rm -fr test_image_output/
python3 sort_images_into_directories.py ../../test-images/ test_image_output/
tree test_image_output/
結果如下圖
心得:
xnor.ai的執行速度不會輸給darknet(其CEO Ali Farhadi是華盛頓大學計算機系教授,真的很厲害!!),可見這二年他們想要將深度學習模型直接跑在樹莓派上是成功的。
本篇原是筆者為了要做demo而記錄,事後想一想,就是因為要demo才有動力去解開這些步驟,也算是箇小成就感吧!!
本篇原是筆者為了要做demo而記錄,事後想一想,就是因為要demo才有動力去解開這些步驟,也算是箇小成就感吧!!
參攷:
1.Xnor.ai
2.Tutorial in C, https://ai2go.xnor.ai/getting-started/c/part-1-orientation-and-setup-in-c
3.Tutorial in Python, https://ai2go.xnor.ai/getting-started/python/part-1-orientation-and-setup-in-python
1.Xnor.ai
2.Tutorial in C, https://ai2go.xnor.ai/getting-started/c/part-1-orientation-and-setup-in-c
3.Tutorial in Python, https://ai2go.xnor.ai/getting-started/python/part-1-orientation-and-setup-in-python
留言