Skip to content

Commit 886b57a

Browse files
committed
optimize doc display var and update python usage doc
1 parent e333aba commit 886b57a

37 files changed

+99
-89
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@ from maix import camera, display, image, nn
4444

4545
classifier = nn.Classifier(model="/root/models/mobilenetv2.mud")
4646
cam = camera.Camera(classifier.input_width(), classifier.input_height(), classifier.input_format())
47-
dis = display.Display()
47+
disp = display.Display()
4848

4949
while 1:
5050
img = cam.read()
5151
res = classifier.classify(img)
5252
max_idx, max_prob = res[0]
5353
msg = f"{max_prob:5.2f}: {classifier.labels[max_idx]}"
5454
img.draw_string(10, 10, msg, image.COLOR_RED)
55-
dis.show(img)
55+
disp.show(img)
5656
```
5757

5858
Result video:

docs/doc/en/basic/app.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,8 @@ install_app(pkg_path)
6969
- Since touchscreens are standard, it is recommended to create a simple interface with touch interaction. You can refer to examples for implementation methods.
7070
- Avoid making interfaces and buttons too small, as MaixCAM default screen is 2.3 inches with 552x368 resolution and high PPI. Make sure fingers can easily tap without making mistakes.
7171
- Implement a simple serial interaction for the main functionality of each application based on the [serial protocol](https://github.com/sipeed/MaixCDK/blob/master/docs/doc/convention/protocol.md) (see [example](https://github.com/sipeed/MaixPy/tree/main/examples/communication/protocol)). This way, users can directly use it as a serial module. For instance, in a face detection application, you can output coordinates via serial port when a face is detected.
72+
73+
## APP power on auto start
74+
75+
Refer to [APP auto start on power up](./auto_start.md).
76+

docs/doc/en/basic/python.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ After mastering the basic syntax, you will be able to use MaixPy for programming
6060

6161
### Using Built-in Packages
6262

63-
Python comes with many commonly used packages and APIs built-in, so if you encounter any issues, you can search for “Python using xxxx” and you might find a solution right away. This applies to various common tasks, such as file handling, networking, system operations, algorithms, and more.
63+
Python comes with many commonly used packages and APIs built-in, so if you encounter any issues, you can search for “Python using xxxx” and you might find a solution right away. This applies to various common tasks, such as file handling, multi thread, multi process, networking, system operations, algorithms, and more.
6464

6565
For example:
6666
For those who are new to Python and have only dabbled in basic microcontroller development, they might wonder why there are no examples in the documentation for reading and writing to SD/TF cards. The reason is that a file system is already running on the SD/TF card by default, so you can use Python’s file handling APIs to read and write files directly on the SD card:

docs/doc/en/comm/maix_protocol.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ while not app.need_exit():
5555
img.draw_rect(obj.x, obj.y, obj.w, obj.h, color = image.COLOR_RED)
5656
msg = f'{detector.labels[obj.class_id]}: {obj.score:.2f}'
5757
img.draw_string(obj.x, obj.y, msg, color = image.COLOR_RED)
58-
dis.show(img)
58+
disp.show(img)
5959
```
6060
You can see that `objs` is a list of detection results. Here, we draw bounding boxes on the screen, but we can also send these results via UART.
6161

docs/doc/en/faq.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -189,25 +189,25 @@ This is not an error message. It is a log message indicating that the multimedia
189189

190190
By default only support English charactors, if you want to show Chinese, you need to change font, refer to [Custom fonts part of image basic operation](./vision/image_ops.md#Chinese-support-and-custom-fonts)
191191

192-
## Program Exits with Prompt: app exit with code: 1
193-
194-
This occurs because the program encountered an error and exited abnormally. You need to check the logs to identify the issue. Here's how to check the logs:
195-
196-
### Method 1:
197-
1. First, use **MaixVision** to connect to the device, ensuring all programs occupying the display and camera are closed.
198-
2. Then connect to the device via **SSH** to access the SSH terminal. For details on connecting, refer to the [Linux Basics](./basic/linux_basic.md).
199-
3. Execute the following commands:
200-
- For Python programs:
201-
```bash
202-
cd /maixapp/apps/xxx && python main.py
203-
```
204-
Here, `xxx` is the ID of the application that encountered the error.
205-
- For non-Python programs:
206-
```bash
207-
cd /maixapp/apps/xxx && ./xxx
208-
```
209-
Again, `xxx` is the ID of the application that encountered the error.
210-
4. Carefully review the logs to check for errors. Note that errors might not always be at the last line, so check thoroughly from the end upward.
192+
### Program Exit and Message: "app exit with code: 1, log in /maixapp/tmp/last_run.log"
193+
194+
This indicates that the program encountered an error and exited unexpectedly. You need to check the log to find the issue.
195+
196+
#### How to Check the Logs:
197+
198+
- **Method 1**: View the `/maixapp/tmp/last_run.log` file immediately after the error:
199+
1. On MaixVision, run the script `MaixPy/examples/tools/show_last_run_log.py` to view the log.
200+
2. On an SSH terminal, use the command `cat /maixapp/tmp/last_run.log` to view the log.
201+
202+
- **Method 2**:
203+
- First, use MaixVision to connect to the device to exit any programs that are using the display or camera.
204+
- Then, connect to the device via SSH and enter the SSH terminal. For connection steps, refer to the [Linux Basics](./basic/linux_basic.md).
205+
- Manually run the program using the following commands:
206+
- If it's a Python program: `cd /maixapp/apps/xxx && python main.py`, where `xxx` is the ID of the application that encountered the error.
207+
- If it's not a Python program: `cd /maixapp/apps/xxx && ./xxx`, where `xxx` is the ID of the application that encountered the error.
208+
- Carefully examine the logs for any errors. Note that the error may not appear on the last line, so check the logs from the bottom upwards.
209+
210+
- **Method 3**: If the application is written in Python, use MaixVision to run the source code to view runtime errors and fix them. Again, be aware that the error may not appear on the last line, so check the logs carefully from the bottom upwards.
211211

212212
### Method 2:
213213
If the application is written in Python, use **MaixVision** to run the source code directly, examine the runtime errors, and make corrections. Be aware that errors may not be at the last line, so inspect the logs carefully from the end upward.

docs/doc/en/vision/body_key_points.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ detector = nn.YOLOv8(model="/root/models/yolov8n_pose.mud", dual_buff=True)
2121
# detector = nn.YOLO11(model="/root/models/yolo11n_pose.mud", dual_buff=True)
2222

2323
cam = camera.Camera(detector.input_width(), detector.input_height(), detector.input_format())
24-
dis = display.Display()
24+
disp = display.Display()
2525

2626
while not app.need_exit():
2727
img = cam.read()
@@ -31,7 +31,7 @@ while not app.need_exit():
3131
msg = f'{detector.labels[obj.class_id]}: {obj.score:.2f}'
3232
img.draw_string(obj.x, obj.y, msg, color=image.COLOR_RED)
3333
detector.draw_pose(img, obj.points, 8 if detector.input_width() > 480 else 4, image.COLOR_RED)
34-
dis.show(img)
34+
disp.show(img)
3535
```
3636

3737
You can also find the code in the [MaixPy/examples/vision](https://github.com/sipeed/MaixPy/tree/main/examples/vision/ai_vision) directory.

docs/doc/en/vision/classify.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ from maix import camera, display, image, nn
1515

1616
classifier = nn.Classifier(model="/root/models/mobilenetv2.mud", dual_buff = True)
1717
cam = camera.Camera(classifier.input_width(), classifier.input_height(), classifier.input_format())
18-
dis = display.Display()
18+
disp = display.Display()
1919

2020
while 1:
2121
img = cam.read()
2222
res = classifier.classify(img)
2323
max_idx, max_prob = res[0]
2424
msg = f"{max_prob:5.2f}: {classifier.labels[max_idx]}"
2525
img.draw_string(10, 10, msg, image.COLOR_RED)
26-
dis.show(img)
26+
disp.show(img)
2727
```
2828

2929
Result video:

docs/doc/en/vision/dual_buff.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ detector = nn.YOLOv5(model="/root/models/yolov5s.mud", dual_buff=True)
1313
# detector = nn.YOLOv8(model="/root/models/yolov8n.mud", dual_buff=True)
1414

1515
cam = camera.Camera(detector.input_width(), detector.input_height(), detector.input_format())
16-
dis = display.Display()
16+
disp = display.Display()
1717

1818
while not app.need_exit():
1919
img = cam.read()
@@ -22,7 +22,7 @@ while not app.need_exit():
2222
img.draw_rect(obj.x, obj.y, obj.w, obj.h, color = image.COLOR_RED)
2323
msg = f'{detector.labels[obj.class_id]}: {obj.score:.2f}'
2424
img.draw_string(obj.x, obj.y, msg, color = image.COLOR_RED)
25-
dis.show(img)
25+
disp.show(img)
2626
```
2727

2828
Generally, this parameter defaults to `True`, unless you manually set `dual_buff=False` to disable the dual buffer function.

docs/doc/en/vision/face_detection.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ from maix import camera, display, image, nn, app
2424
detector = nn.YOLOv8(model="/root/models/yolov8n_face.mud", dual_buff = True)
2525

2626
cam = camera.Camera(detector.input_width(), detector.input_height(), detector.input_format())
27-
dis = display.Display()
27+
disp = display.Display()
2828

2929
while not app.need_exit():
3030
img = cam.read()
@@ -34,7 +34,7 @@ while not app.need_exit():
3434
msg = f'{detector.labels[obj.class_id]}: {obj.score:.2f}'
3535
img.draw_string(obj.x, obj.y, msg, color = image.COLOR_RED)
3636
detector.draw_pose(img, obj.points, 2, image.COLOR_RED)
37-
dis.show(img)
37+
disp.show(img)
3838
```
3939

4040
For the other two models:
@@ -48,7 +48,7 @@ detector = nn.Retinaface(model="/root/models/retinaface.mud")
4848
# detector = nn.FaceDetector(model="/root/models/face_detector.mud")
4949

5050
cam = camera.Camera(detector.input_width(), detector.input_height(), detector.input_format())
51-
dis = display.Display()
51+
disp = display.Display()
5252

5353
while not app.need_exit():
5454
img = cam.read()
@@ -57,7 +57,7 @@ while not app.need_exit():
5757
img.draw_rect(obj.x, obj.y, obj.w, obj.h, color = image.COLOR_RED)
5858
radius = math.ceil(obj.w / 10)
5959
img.draw_keypoints(obj.points, image.COLOR_RED, size = radius if radius < 5 else 4)
60-
dis.show(img)
60+
disp.show(img)
6161
```
6262

6363
## Model Downloads and Other Resolution Models

docs/doc/en/vision/face_recognition.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ recognizer = nn.FaceRecognizer(detect_model="/root/models/yolov8n_face.mud", fea
3333
if os.path.exists("/root/faces.bin"):
3434
recognizer.load_faces("/root/faces.bin")
3535
cam = camera.Camera(recognizer.input_width(), recognizer.input_height(), recognizer.input_format())
36-
dis = display.Display()
36+
disp = display.Display()
3737

3838
while 1:
3939
img = cam.read()
@@ -44,7 +44,7 @@ while 1:
4444
img.draw_keypoints(obj.points, image.COLOR_RED, size = radius if radius < 5 else 4)
4545
msg = f'{recognizer.labels[obj.class_id]}: {obj.score:.2f}'
4646
img.draw_string(obj.x, obj.y, msg, color = image.COLOR_RED)
47-
dis.show(img)
47+
disp.show(img)
4848
```
4949

5050
When you first run this code, it can detect faces but will not recognize them. We need to enter a mode to learn faces.

0 commit comments

Comments
 (0)