TinyML
来自Jack's Lab
1 Overview
TinyML 基金会在 2019 年组织了第一届峰会,这届峰会的成果如下:
- TinyML 的技术硬件已经进入了实用性的阶段;
- 算法,网络以及低于 100KB 的 ML 模型,已经取得重大突破;
- 视觉,音频的低功耗需求快速增长。
2 Hardware
- Sparkfunc Edge:
- Cortex-M4F up to 48MHz, 6uA/MHz (Ambiq Micro Apollo3 Blue) https://ambiq.com/apollo3-blue-datasheet/
- 1MB Flash, 384KB RAM
- Arduino Nano 33 BLE Sense Nano 33 Datasheet
- Cortex-M4F, up to 64MHz, 52 µA/MHz (Nordic nRF52480) https://content.arduino.cc/assets/Nano_BLE_MCU-nRF52840_PS_v1.1.pdf
- 1 MB Flash, 256 kB RAM
- STM32F746G Discovery Kit
- Cortex®-M7 up to 216MHz STM32F746G DS
- 1 MB Flash, 320KB RAM
- LQFP100 (14x14 mm), TFBGA100 (8x8 mm), WLCSP143 (4.5x5.8 mm)
3 Quick Start
$ pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple tensorflow-gpu==2.5.0
$ python3
import tensorflow as tf
>>> print(tf.__version__)
2.5.0
>>> print('GPU: ', tf.test.is_gpu_available())
2022-04-01 03:24:13.099644: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1733] Found device 0 with properties:
pciBusID: 0000:01:00.0 name: NVIDIA GeForce GTX 1050 computeCapability: 6.1
coreClock: 1.493GHz coreCount: 5 deviceMemorySize: 4.00GiB deviceMemoryBandwidth: 104.43GiB/s
2022-04-01 03:24:13.099980: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1871] Adding visible gpu devices: 0
2022-04-01 03:24:13.100248: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1258] Device interconnect StreamExecutor with strength 1 edge matrix:
2022-04-01 03:24:13.100459: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1264] 0
2022-04-01 03:24:13.100669: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1277] 0: N
2022-04-01 03:24:13.100967: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1418] Created TensorFlow device (/device:GPU:0 with 2779 MB memory) -> physical G
PU (device: 0, name: NVIDIA GeForce GTX 1050, pci bus id: 0000:01:00.0, compute capability: 6.1)
GPU: True
>>> hello = tf.constant('Hello, Tensorflow!')
>>> print(hello)
tf.Tensor(b'Hello, Tensorflow!', shape=(), dtype=string)
>>> from tensorflow.python.client import device_lib
>>> print(device_lib.list_local_devices())
[name: "/device:CPU:0"
device_type: "CPU"
memory_limit: 268435456
locality {
}
incarnation: 12041451716771642396
, name: "/device:GPU:0"
device_type: "GPU"
memory_limit: 2914163099
locality {
bus_id: 1
links {
}
}
incarnation: 596105631149220834
physical_device_desc: "device: 0, name: NVIDIA GeForce GTX 1050, pci bus id: 0000:01:00.0, compute capability: 6.1"
]