Skip to content

Commit 25af7ef

Browse files
Apply suggestions from code review
1 parent 8d2c994 commit 25af7ef

File tree

2 files changed

+34
-23
lines changed

2 files changed

+34
-23
lines changed
Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,36 @@
11
== Model Deployment
22

3-
The process of deploying a new neural network model to the Raspberry Pi AI Camera will normally consist of the following steps:
3+
To deploy a new neural network model to the Raspberry Pi AI Camera, complete the following steps:
44

5-
. A neural network model must be provided.
6-
. The model must be quantised and compressed so that it can be run using the resources available in the IMX500 camera.
7-
. The compressed model must be converted to IMX500 format.
8-
. Finally, the model must be packaged into a firmware file that can be loaded at runtime into the camera.
5+
. Provide a neural network model.
6+
. Quantise and compress the model so that it can run using the resources available on the IMX500 camera module.
7+
. Convert the compressed model to IMX500 format.
8+
. Package the model into a firmware file that can be loaded at runtime onto the camera.
99

10-
The first three steps will normally be performed on a more powerful computer such as a desktop or server, whilst the final packaging step must be performed on a Raspberry Pi.
10+
The first three steps will normally be performed on a more powerful computer such as a desktop or server. You must run the final packaging step on a Raspberry Pi.
1111

1212
=== Model Creation
1313

1414
The creation of neural network models is beyond the scope of this guide. Existing models can be re-used, or new ones created using popular frameworks like TensorFlow or PyTorch.
1515

16-
For more information, readers are referred to the official https://developer.aitrios.sony-semicon.com/en/raspberrypi-ai-camera[AITRIOS Developer] website.
16+
For more information, see the official https://developer.aitrios.sony-semicon.com/en/raspberrypi-ai-camera[AITRIOS developer website].
1717

1818
=== Quantisation and Compression
1919

20-
Models are quantised and compressed using Sony's _Model Compression Toolkit_. This can be installed with
20+
Models are quantised and compressed using Sony's Model Compression Toolkit. To install the toolkit, run the following command:
2121

2222
[source,console]
2323
----
24-
pip install model_compression_toolkit
24+
$ pip install model_compression_toolkit
2525
----
2626

27-
and information and tutorials can be found at the project's https://github.com/sony/model_optimization[GitHub page].
27+
For more information, see the https://github.com/sony/model_optimization[Sony model optimization GitHub repository].
28+
29+
The Model Compression Toolkit generates a quantised model in the following formats:
30+
31+
* Keras (TensorFlow)
32+
* ONNX (PyTorch)
2833

29-
The _Model Compression Toolkit_ will genearate a quantised model in either Keras (for TensorFlow) or ONNX (for PyTorch) format.
3034

3135
=== Conversion
3236

@@ -48,40 +52,47 @@ pip install imx500-converter[pt]
4852

4953
TIP: If you need to install both these packages, we strongly recommend doing so in separate Python virtual environments (for example, using `python -m venv <virtual-environment-name>`). This avoids any problems with TensorFlow and PyTorch causing conflicts with one another.
5054

51-
Next, we can convert the model. For TensorFlow, use
55+
Next, convert the model:
5256

57+
[tabs]
58+
======
59+
TensorFlow::
60+
+
5361
[source,console]
5462
----
55-
imxconv-tf -i <compressed Keras model> -o <output folder>
63+
$ imxconv-tf -i <compressed Keras model> -o <output folder>
5664
----
5765
58-
and for PyTorch, use
59-
66+
PyTorch::
67+
+
6068
[source,console]
6169
----
62-
imxconv-pt -i <compressed ONNX model> -o <output folder>
70+
$ imxconv-pt -i <compressed ONNX model> -o <output folder>
6371
----
72+
======
6473

65-
In both cases, the output folder will be created containing, among other things, a memory usage report, plus a `packerOut.zip` file which is what we will need to copy to the Pi for the final step.
74+
Both commands create an output folder that contains a memory usage report and a `packerOut.zip` file.
6675

67-
Again, for more information on the model conversion process, please refer to the official https://developer.aitrios.sony-semicon.com/en/raspberrypi-ai-camera/documentation/imx500-converter[IMX500 Converter] documentation.
76+
For more information on the model conversion process, see the official https://developer.aitrios.sony-semicon.com/en/raspberrypi-ai-camera/documentation/imx500-converter[Sony IMX500 Converter documentation].
6877

6978
=== Packaging
7079

71-
The final step, which we run on a Raspberry Pi, is packaging the model into an _RPK_ file. This _RPK_ file is then uploaded to the IMX500 camera when running the neural network model. Before proceeding, we must install the necessary tools:
80+
IMPORTANT: You must run this step on a Raspberry Pi.
81+
82+
The final step packages the model into an RPK file. When running the neural network model, we'll upload this file to the AI Camera. Before proceeding, run the following command to install the necessary tools:
7283

7384
[source,console]
7485
----
7586
$ sudo apt install imx500-tools
7687
----
7788

78-
Now we can run
89+
To package the model into an RPK file, run the following command:
7990

8091
[source,console]
8192
----
8293
imx500-package.sh -i <path to packerOut.zip> -o <output folder>
8394
----
8495

85-
The output folder should finally contain a file `network.rpk`, the name of which is what we pass to our IMX500 camera applications.
96+
This command should create a file named `network.rpk` in the output folder. You'll pass the name of this file to your IMX500 camera applications.
8697

87-
More specific instructions on all these tools, and their constraints is out of scope for this tutorial. For a more comprehensive set of instructions and further specifics on the tools used, please see the official https://developer.aitrios.sony-semicon.com/en/raspberrypi-ai-camera/documentation/imx500-packager[IMX500 Packager] documentation.
98+
For a more comprehensive set of instructions and further specifics on the tools used, see the https://developer.aitrios.sony-semicon.com/en/raspberrypi-ai-camera/documentation/imx500-packager[Sony IMX500 Packager documentation].

documentation/asciidoc/computers/raspberry-pi/pcie.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ To connect a PCIe https://datasheets.raspberrypi.com/hat/hat-plus-specification.
99

1010
For more information about the PCIe FPC connector pinout and other details needed to create third-party devices, accessories, and HATs, see the https://datasheets.raspberrypi.com/pcie/pcie-connector-standard.pdf[Raspberry Pi Connector for PCIe] standards document. It should be read alongside the https://datasheets.raspberrypi.com/hat/hat-plus-specification.pdf[Raspberry Pi HAT+ Specification].
1111

12-
NOTE: Starting with version 2020-06-05 of the Raspberry Pi 5 bootloader, Enumeration of PCIe devices behind a switch is preliminary supported. See also this https://github.com/raspberrypi/firmware/issues/1833[issue].
12+
NOTE: Only certain devices [support](https://github.com/raspberrypi/firmware/issues/1833[support]) enumeration of PCIe devices behind a switch.
1313

1414
=== Enable PCIe
1515

0 commit comments

Comments
 (0)