diff --git a/source/_static/amebapro2/Example_Guides/File_System/Display_Used_and_Free_space_of_SD_card/image01.png b/source/_static/amebapro2/Example_Guides/File_System/Display_Used_and_Free_space_of_SD_card/image01.png new file mode 100644 index 0000000..b3768e9 Binary files /dev/null and b/source/_static/amebapro2/Example_Guides/File_System/Display_Used_and_Free_space_of_SD_card/image01.png differ diff --git a/source/_static/amebapro2/Example_Guides/File_System/Display_Used_and_Free_space_of_SD_card/image02.png b/source/_static/amebapro2/Example_Guides/File_System/Display_Used_and_Free_space_of_SD_card/image02.png new file mode 100644 index 0000000..ba583f0 Binary files /dev/null and b/source/_static/amebapro2/Example_Guides/File_System/Display_Used_and_Free_space_of_SD_card/image02.png differ diff --git a/source/_static/amebapro2/Example_Guides/Neural_Network/Neural_Network_-_UVCD_Object_Detection/image01.png b/source/_static/amebapro2/Example_Guides/Neural_Network/Neural_Network_-_UVCD_Object_Detection/image01.png new file mode 100644 index 0000000..d93f6eb Binary files /dev/null and b/source/_static/amebapro2/Example_Guides/Neural_Network/Neural_Network_-_UVCD_Object_Detection/image01.png differ diff --git a/source/_static/amebapro2/Example_Guides/Neural_Network/Neural_Network_-_UVCD_Object_Detection/image02.png b/source/_static/amebapro2/Example_Guides/Neural_Network/Neural_Network_-_UVCD_Object_Detection/image02.png new file mode 100644 index 0000000..58f5033 Binary files /dev/null and b/source/_static/amebapro2/Example_Guides/Neural_Network/Neural_Network_-_UVCD_Object_Detection/image02.png differ diff --git a/source/_static/amebapro2/Example_Guides/Neural_Network/Neural_Network_-_UVCD_Object_Detection/image03.png b/source/_static/amebapro2/Example_Guides/Neural_Network/Neural_Network_-_UVCD_Object_Detection/image03.png new file mode 100644 index 0000000..7ea6aea Binary files /dev/null and b/source/_static/amebapro2/Example_Guides/Neural_Network/Neural_Network_-_UVCD_Object_Detection/image03.png differ diff --git a/source/_static/amebapro2/Example_Guides/Neural_Network/Neural_Network_-_UVCD_Object_Detection/image04.png b/source/_static/amebapro2/Example_Guides/Neural_Network/Neural_Network_-_UVCD_Object_Detection/image04.png new file mode 100644 index 0000000..f69bd36 Binary files /dev/null and b/source/_static/amebapro2/Example_Guides/Neural_Network/Neural_Network_-_UVCD_Object_Detection/image04.png differ diff --git a/source/_static/amebapro2/Example_Guides/Neural_Network/Neural_Network_-_UVCD_Object_Detection/image05.png b/source/_static/amebapro2/Example_Guides/Neural_Network/Neural_Network_-_UVCD_Object_Detection/image05.png new file mode 100644 index 0000000..0080eb3 Binary files /dev/null and b/source/_static/amebapro2/Example_Guides/Neural_Network/Neural_Network_-_UVCD_Object_Detection/image05.png differ diff --git a/source/_static/amebapro2/Example_Guides/Neural_Network/Neural_Network_-_UVCD_Object_Detection/image06.png b/source/_static/amebapro2/Example_Guides/Neural_Network/Neural_Network_-_UVCD_Object_Detection/image06.png new file mode 100644 index 0000000..1cd2ca3 Binary files /dev/null and b/source/_static/amebapro2/Example_Guides/Neural_Network/Neural_Network_-_UVCD_Object_Detection/image06.png differ diff --git a/source/_static/amebapro2/Example_Guides/Neural_Network/Neural_Network_-_UVCD_Object_Detection/image07.png b/source/_static/amebapro2/Example_Guides/Neural_Network/Neural_Network_-_UVCD_Object_Detection/image07.png new file mode 100644 index 0000000..28b5c5d Binary files /dev/null and b/source/_static/amebapro2/Example_Guides/Neural_Network/Neural_Network_-_UVCD_Object_Detection/image07.png differ diff --git a/source/amebapro2/API_Documents/FileSystem/Class AmebaFatFS.rst b/source/amebapro2/API_Documents/FileSystem/Class AmebaFatFS.rst index e4f492c..9bb201c 100644 --- a/source/amebapro2/API_Documents/FileSystem/Class AmebaFatFS.rst +++ b/source/amebapro2/API_Documents/FileSystem/Class AmebaFatFS.rst @@ -62,6 +62,10 @@ A class for file management using FatFS File system. +----------------------------+------------------------------------------+ | AmebaFatFS::status | Check if the file system is initialized | +----------------------------+------------------------------------------+ +| AmebaFatFS::get_free_space | Retrieve the free space of SDcard | ++----------------------------+------------------------------------------+ +| AmebaFatFS::get_used_space | Retrieve the used space of SDcard | ++----------------------------+------------------------------------------+ **AmebaFatFS::AmebaFatFS** -------------------------- @@ -604,3 +608,66 @@ This function returns 1 if the file system is initialized, 0 otherwise. NA .. note :: "AmebaFatFS.h" must be included to use the class function. + +**AmebaFatFS::get_free_space** +------------------------------ + +**Description** +~~~~~~~~~~~~~~~ + +Retrieve the free space of SDcard. + +**Syntax** +~~~~~~~~~~ + +.. code-block:: c++ + + long long int get_free_space(void); + +**Parameters** +~~~~~~~~~~~~~~ +NA + +**Returns** +~~~~~~~~~~~ + +This function returns the value of free space size up to 8-bytes. + +**Example Code** +~~~~~~~~~~~~~~~~ + +Example: `GetFreeAndUseSpace `_ + +.. note :: "AmebaFatFS.h" must be included to use the class function. + +**AmebaFatFS::get_used_space** +------------------------------ + +**Description** +~~~~~~~~~~~~~~~ + +Retrieve the used space of SDcard. + +**Syntax** +~~~~~~~~~~ + +.. code-block:: c++ + + long long int get_used_space(void); + +**Parameters** +~~~~~~~~~~~~~~ +NA + +**Returns** +~~~~~~~~~~~ + +This function returns the value of used space size up to 8-bytes. + +**Example Code** +~~~~~~~~~~~~~~~~ + +Example: `GetFreeAndUseSpace `_ + +.. note :: "AmebaFatFS.h" must be included to use the class function. + \ No newline at end of file diff --git a/source/amebapro2/API_Documents/Multimedia/Class VideoStream.rst b/source/amebapro2/API_Documents/Multimedia/Class VideoStream.rst index d6c4338..f18cff3 100644 --- a/source/amebapro2/API_Documents/Multimedia/Class VideoStream.rst +++ b/source/amebapro2/API_Documents/Multimedia/Class VideoStream.rst @@ -1636,6 +1636,10 @@ A class used to configure and initialize the camera to generate video data strea | Video::printInfo | Print out current configuration of | | | video channels. | +----------------------------+-----------------------------------------+ +| Video::videostream_status | Retrieve video stream module contents | +| | from specific channel and pass for | +| | checking on UVC connection status. | ++----------------------------+-----------------------------------------+ **Video::configVideoChannel** ----------------------------- @@ -2000,3 +2004,37 @@ NA Example: `StreamRTSP/VideoOnly `_ .. note :: "VideoStream.h" must be included to use the class function. + +**Video::videostream_status** +------------------------------ + +**Description** +~~~~~~~~~~~~~~~ + +Retrieve video stream module contents from specific channel and pass for checking on UVC connection status. + +**Syntax** +~~~~~~~~~~ + +.. code-block:: c++ + + int videostream_status(int ch); + +**Parameters** +~~~~~~~~~~~~~~ + +ch: Channel to configure. + +- 0 + +**Returns** +~~~~~~~~~~~ + +This function returns 1 if the UVC device is connected to PC, 0 otherwise. + +**Example Code** +~~~~~~~~~~~~~~~~ + +Example: `UVCDObjectDetectionLoop `_ + +.. note :: "VideoStream.h" must be included to use the class function. diff --git a/source/amebapro2/API_Documents/USB/Class UVCD.rst b/source/amebapro2/API_Documents/USB/Class UVCD.rst index 3ea26ac..6456585 100644 --- a/source/amebapro2/API_Documents/USB/Class UVCD.rst +++ b/source/amebapro2/API_Documents/USB/Class UVCD.rst @@ -32,9 +32,17 @@ A class for USB UVC device API. +-----------------------------------+----------------------------------+ | **Public Methods** | +-----------------------------------+----------------------------------+ +| UVCD::isUsbUvcConnected | Check if the UVC device | +| | is connected to PC and | +| | video stream. | ++-----------------------------------+----------------------------------+ | UVCD::configVideo | Start config video of using USB | | | UVC device. | +-----------------------------------+----------------------------------+ +| UVCD::nnbegin | Begin video streaming of using | +| | USB UVC device for object | +| | detection. | ++-----------------------------------+----------------------------------+ | UVCD::begin | Begin video streaming of using | | | USB UVC device. | +-----------------------------------+----------------------------------+ @@ -72,6 +80,38 @@ Example: `UVC_Device `_ + +.. note :: "UVCD.h" and "VideoStream.h" must be included to use the class function. + **UVCD::configVideo** --------------------- @@ -104,6 +144,46 @@ Example: `UVC_Device `_ + +.. note :: "UVCD.h", "StreamIO.h" and "VideoStream.h" must be included to use the class function. + **UVCD::begin** --------------- diff --git a/source/amebapro2/Example_Guides/File System/Display Free and Use space of SD card.rst b/source/amebapro2/Example_Guides/File System/Display Free and Use space of SD card.rst new file mode 100644 index 0000000..a48e3c4 --- /dev/null +++ b/source/amebapro2/Example_Guides/File System/Display Free and Use space of SD card.rst @@ -0,0 +1,41 @@ +Display Free and Use space of SD card +===================================== + +.. contents:: + :local: + :depth: 2 + +Materials +--------- + +- `AMB82-mini `_ x 1 + +- MicroSD card + +Example +------- + +In this example, we will be using Ameba Pro2 development board to retrieve free and use space of SD card. + +Procedure +~~~~~~~~~ + +Insert a MicroSD card into the SD card slot of the AMB82 MINI board. + +Open the example, "Files" -> "Examples" -> "AmebaFileSystem" -> "GetFreeAndUseSpace". + +|image01| + +Upload the code and press the reset button on the board once the upload is finished. + +The sample code will print out the used space and free space of the SD card to the serial monitor. + +|image02| + +.. |image01| image:: ../../../_static/amebapro2/Example_Guides/File_System/Display_Used_and_Free_space_of_SD_card/image01.png + :width: 900 px + :height: 550 px +.. |image02| image:: ../../../_static/amebapro2/Example_Guides/File_System/Display_Used_and_Free_space_of_SD_card/image02.png + :width: 700 px + :height: 400 px + \ No newline at end of file diff --git a/source/amebapro2/Example_Guides/File System/index.rst b/source/amebapro2/Example_Guides/File System/index.rst index e2f54ad..8d275dd 100644 --- a/source/amebapro2/Example_Guides/File System/index.rst +++ b/source/amebapro2/Example_Guides/File System/index.rst @@ -5,4 +5,6 @@ File System :maxdepth: 1 Read and display HTML file from SD card - Simple applications with SD card \ No newline at end of file + Simple applications with SD card + Display Free and Use space of SD card + \ No newline at end of file diff --git a/source/amebapro2/Example_Guides/Neural Network/UVCD Object Detection.rst b/source/amebapro2/Example_Guides/Neural Network/UVCD Object Detection.rst new file mode 100644 index 0000000..03c4c1c --- /dev/null +++ b/source/amebapro2/Example_Guides/Neural Network/UVCD Object Detection.rst @@ -0,0 +1,101 @@ +UVCD Object Detection +===================== + +.. contents:: + :local: + :depth: 2 + +Materials +--------- + +- `AMB82-mini `_ x 1 + +Example +------- + +In this example, we will be using Ameba Pro2 development board to detect 80 different kinds of objects such as person, bicycle, car, laptop etc using on-board camera sensor (JX-F37P). + +The following examples show how Object Detection and On-Screen Display is used. + +Open the example, “File” -> “Examples” -> “AmebaNN” -> "UVCDObjectDetectionLoop". + +|image01| + +Select Neural Network (NN) task and models using modelSelect() function highlighted in yellow. This function takes 4 arguments: Neural Network task, Object Detection model, Face Detection model and Face Recognition model. Replace with “NA_MODEL” if they are not necessary for your selected Neural Network task. Note that it is mandatory to call modelSelect() function before calling the begin() function. + +Valid Neural Network task: OBJECT_DETECTION, FACE_DETECTION, FACE_RECOGNITION + +Valid Object Detection model: + +YOLOv3 model: DEFAULT_YOLOV3TINY, CUSTOMIZED_YOLOV3TINY + +YOLOv4 model: DEFAULT_YOLOV4TINY, CUSTOMIZED_YOLOV4TINY + +YOLOv7 model: DEFAULT_YOLOV7TINY, CUSTOMIZED_YOLOV7TINY + +Valid Face Detection model: DEFAULT_SCRFD, CUSTOMIZED_SCRFD + +Valid Face Recognition model: DEFAULT_MOBILEFACENET, CUSTOMIZED_MOBILEFACENET + +Choose the customized option (e.g., CUSTOMIZED_YOLOV4TINY/ CUSTOMIZED_SCRFD/ CUSTOMIZED_MOBILEFACENET) if you would like to use your own NN model. To learn about the process of converting an AI model, refer to https://www.amebaiot.com/en/amebapro2-ai-convert-model/ . Additionally, refer to https://www.amebaiot.com/en/amebapro2-apply-ai-model-docs/ to understand how to install and use the converted model. + +Note that for Yolov7 object detection training from pytorch, you will need to perform an additional step for reparameterization. For this reparameterization step, Realtek has provided two scripts in the folder Yolov7_reparam_scripts, under ~/NeuralNetwork/Yolov7_reparam_scripts. + +Command to run is: + +python reparam_yolov7-tiny.py --weights weights/best.pt --custom_yaml custom/yolov7-tiny-deploy.yaml --output best_reparam.pt + +|image02| + +Compile the code and upload it to Ameba. After pressing the Reset button, connect the “USB OTG” via micro-USB cable to the target device such as PC. + +|image03| + +Review the USB cam driver as following picture. + +|image04| + +The result of detected objects can be validated using Potplayer. You may download Potplayer from the link `here `__. + +Upon the completion of the software installation, open Potplayer, and go to “PotPlayer” -> “Open” -> "Device Settings". + +|image05| + +Next, on Device and Format drop down menu, select "USB UVC CLASS" and "H264 1920x1080 24" and click "Open device". + +|image06| + +The video stream from the camera will be shown in Potplayer. + +A bounding box with its object name and confidence score will be drawn on the RTSP video stream to highlight the recognised objects. + +|image07| + +.. |image01| image:: ../../../_static/amebapro2/Example_Guides/Neural_Network/Neural_Network_-_UVCD_Object_Detection/image01.png + :width: 900 px + :height: 550 px + +.. |image02| image:: ../../../_static/amebapro2/Example_Guides/Neural_Network/Neural_Network_-_UVCD_Object_Detection/image02.png + :width: 817 px + :height: 550 px + +.. |image03| image:: ../../../_static/amebapro2/Example_Guides/Neural_Network/Neural_Network_-_UVCD_Object_Detection/image03.png + :width: 687 px + :height: 600 px + +.. |image04| image:: ../../../_static/amebapro2/Example_Guides/Neural_Network/Neural_Network_-_UVCD_Object_Detection/image04.png + :width: 432 px + :height: 482 px + +.. |image05| image:: ../../../_static/amebapro2/Example_Guides/Neural_Network/Neural_Network_-_UVCD_Object_Detection/image05.png + :width: 900 px + :height: 550 px + +.. |image06| image:: ../../../_static/amebapro2/Example_Guides/Neural_Network/Neural_Network_-_UVCD_Object_Detection/image06.png + :width: 602 px + :height: 400 px + +.. |image07| image:: ../../../_static/amebapro2/Example_Guides/Neural_Network/Neural_Network_-_UVCD_Object_Detection/image07.png + :width: 772 px + :height: 453 px + \ No newline at end of file diff --git a/source/amebapro2/Example_Guides/Neural Network/index.rst b/source/amebapro2/Example_Guides/Neural Network/index.rst index cb058be..ca2b639 100644 --- a/source/amebapro2/Example_Guides/Neural Network/index.rst +++ b/source/amebapro2/Example_Guides/Neural Network/index.rst @@ -11,4 +11,5 @@ Neural Network Face Recognition Image Classification Object Detection + UVCD Object Detection \ No newline at end of file