aisingapore / PeekingDuck

A modular framework built to simplify Computer Vision inference workloads.
Apache License 2.0
163 stars 39 forks source link

PeekingDuck Installation for Apple Silicon Mac macOS Big Sur/Monterey #445

Open leeping-ng opened 3 years ago

leeping-ng commented 3 years ago

Please see updated instructions below.

diwei-tan commented 3 years ago

After installation I tried: peekingduck init then peekingduck run. Got the following error:

❯ peekingduck run 2021-10-19 11:44:32 peekingduck.declarative_loader INFO: Successfully loaded run_config file. 2021-10-19 11:44:32 peekingduck.declarative_loader INFO: Initialising input.live node... 2021-10-19 11:44:34 peekingduck.pipeline.nodes.input.live INFO: Device resolution used: 1280 by 720 2021-10-19 11:44:34 peekingduck.declarative_loader INFO: Initialising model.yolo node... 2021-10-19 11:44:35 peekingduck.pipeline.nodes.model.yolov4.yolo_files.detector INFO: Yolo model loaded with following configs: Model type: v4tiny, Input resolution: 416, IDs being detected: [0] Max Detections per class: 50, Max Total Detections: 50, IOU threshold: 0.5, Score threshold: 0.2 Metal device set to: Apple M1

systemMemory: 16.00 GB maxCacheSize: 5.33 GB

2021-10-19 11:44:36 peekingduck.declarative_loader INFO: Initialising draw.bbox node... 2021-10-19 11:44:36 peekingduck.declarative_loader INFO: Initialising output.screen node... /AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Sources/MetalPerformanceShaders/MetalPerformanceShaders-124.2.1/MPSNDArray/Kernels/MPSNDArrayMultiaryKernel.mm:833: failed assertion `Error: Invalid KernelDAG, inputArray.dataType == DAG->_placeholderOps->at(i)->_outputs->at(0)->_dType (i = 0) failed' [1] 63447 abort peekingduck run

ongtw commented 3 years ago

Hmm... interesting. I've never seen this error before. I also checked and don't have the /AppleInternal folder. My ~/Library/Caches also don't have com.apple.xbs. This is confounding... Looks like we need more test samples for M1 Mac installs.

ongtw commented 2 years ago

PeekingDuck M1 Mac Installation for macOS Monterey/Big Sur (update 2022-03-02)

Prerequisites

Setup Conda Environment

  1. conda create -n pkd python=3.8
  2. conda activate pkd
  3. conda install click colorama opencv openblas pyyaml requests scipy shapely tqdm

Install Tensorflow (macOS Monterey)

  1. conda install -c apple tensorflow-deps==2.7.0
  2. pip install tensorflow-estimator==2.7.0 tensorflow-macos==2.7.0 tensorflow-metal==0.3.0

Install Tensorflow (macOS Big Sur)

  1. conda install -c apple tensorflow-deps==2.6.0
  2. pip install tensorflow-estimator==2.6.0 tensorflow-macos==2.6.0 tensorflow-metal==0.2.0

Install PyTorch (currently CPU-only)

  1. pip install torch torchvision

Install PeekingDuck

  1. pip install peekingduck --no-dependencies

Notes:

ongtw commented 2 years ago

For the latest updates, please see https://peekingduck.readthedocs.io/en/stable/getting_started/03_custom_install.html#apple-silicon-mac