diff --git a/R01_object_detection/README.md b/R01_object_detection/README.md
index 3a92476..632fb0b 100755
--- a/R01_object_detection/README.md
+++ b/R01_object_detection/README.md
@@ -91,7 +91,7 @@ The AI model used for the sample application is [YOLOV3](https://arxiv.org/pdf/1
microSD card |
Used as the filesystem.
- Must have over 4GB capacity of blank space.
+ Must have over 16GB capacity of blank space.
Operating Environment: Transcend UHS-I microSD 300S 16GB |
@@ -224,10 +224,10 @@ Replace each variable according to your board.
cd ${PROJECT_PATH}/R01_object_detection//yolov3_onnx
wget /
```
- |Board | `EXE_DIR` |`SO_FILE` |`URL` |
- |:---|:---|:---|:---|
- |RZ/V2L EVK|[exe_v2l](./exe_v2l) |`R01_object_detection_deploy_tvm-v111.so` |[Release v2.00](https://github.com/renesas-rz/rzv_ai_sdk/releases/tag/v2.00/) |
- |RZ/V2H EVK|[exe_v2h](./exe_v2h) |`R01_object_detection_deploy_tvm_v2h-v210.so` |[Release v3.00](https://github.com/renesas-rz/rzv_ai_sdk/releases/tag/v3.00/) |
+ |Board | `EXE_DIR` |`URL` |`SO_FILE` |File Location |
+ |:---|:---|:---|:---|:---|
+ |RZ/V2L EVK|[exe_v2l](./exe_v2l) |`https://github.com/renesas-rz/rzv_ai_sdk/releases/download/v2.00/` |`R01_object_detection_deploy_tvm-v111.so` |[Release v2.00](https://github.com/renesas-rz/rzv_ai_sdk/releases/tag/v2.00/) |
+ |RZ/V2H EVK|[exe_v2h](./exe_v2h) |`https://github.com/renesas-rz/rzv_ai_sdk/releases/download/v4.00/` |`R01_object_detection_deploy_tvm_v2h-v221.so` |[Release v4.00](https://github.com/renesas-rz/rzv_ai_sdk/releases/tag/v4.00/) |
- E.g., for RZ/V2L EVK, use following commands.
```sh
@@ -247,20 +247,20 @@ Replace each variable according to your board.
4. Check if `libtvm_runtime.so` exists under `/usr/lib64` directory of the rootfs (SD card) on the board.
5. Folder structure in the rootfs (SD Card) would look like:
- ```sh
- ├── usr/
- │ └── lib64/
- │ └── libtvm_runtime.so
- └── home/
- └── root/
- └── tvm/
- ├── yolov3_onnx/
- │ ├── preprocess
- │ ├── deploy.json
- │ ├── deploy.params
- │ └── deploy.so
- ├── coco-labels-2014_2017.txt
- └── object_detection
+ ```
+ |-- usr/
+ | `-- lib64/
+ | `-- libtvm_runtime.so
+ `-- home/
+ `-- root/
+ `-- tvm/
+ |-- yolov3_onnx/
+ | |-- preprocess
+ | |-- deploy.json
+ | |-- deploy.params
+ | `-- deploy.so
+ |-- coco-labels-2014_2017.txt
+ `-- object_detection
```
>**Note:** The directory name could be anything instead of `tvm`. If you copy the whole `EXE_DIR` folder on the board, you are not required to rename it `tvm`.
@@ -287,7 +287,7 @@ After completion of the guide, the user is expected of following things.
|RZ/V2L EVK | RZ/V2H EVK |
|:---|:---|
- || |
+ || |
On application window, following information is displayed.
- Camera capture
@@ -314,7 +314,7 @@ Output3 size: 1x52x52x255
|Board | AI inference time|
|:---|:---|
|RZ/V2L EVK| Approximately 430ms |
-|RZ/V2H EVK | Approximately 40ms |
+|RZ/V2H EVK | Approximately 30ms |
### Processing
diff --git a/R01_object_detection/exe_v2h/object_detection b/R01_object_detection/exe_v2h/object_detection
index 16de0b1..9284529 100755
Binary files a/R01_object_detection/exe_v2h/object_detection and b/R01_object_detection/exe_v2h/object_detection differ
diff --git a/R01_object_detection/exe_v2h/yolov3_onnx/deploy.json b/R01_object_detection/exe_v2h/yolov3_onnx/deploy.json
index 7d1ceb3..b8df01e 100755
--- a/R01_object_detection/exe_v2h/yolov3_onnx/deploy.json
+++ b/R01_object_detection/exe_v2h/yolov3_onnx/deploy.json
@@ -7,14 +7,14 @@
},
{
"op": "tvm_op",
- "name": "tvmgen_default_tvmgen_default_tvmgen_default_mera_drp_main_0",
+ "name": "tvmgen_default_tvmgen_default_mera_drp_main_0",
"attrs": {
"flatten_data": "0",
- "func_name": "tvmgen_default_tvmgen_default_tvmgen_default_mera_drp_main_0",
- "hash": "8204a5bc4fae0685",
+ "func_name": "tvmgen_default_tvmgen_default_mera_drp_main_0",
+ "hash": "eb1640a6874236c6",
"num_outputs": "3",
"num_inputs": "1",
- "global_symbol": "tvmgen_default_tvmgen_default_tvmgen_default_mera_drp_main_0",
+ "global_symbol": "tvmgen_default_tvmgen_default_mera_drp_main_0",
"Compiler": "mera_drp"
},
"inputs": [
diff --git a/R01_object_detection/exe_v2h/yolov3_onnx/preprocess/addr_map.txt b/R01_object_detection/exe_v2h/yolov3_onnx/preprocess/addr_map.txt
index 80eed1d..ca4daef 100755
--- a/R01_object_detection/exe_v2h/yolov3_onnx/preprocess/addr_map.txt
+++ b/R01_object_detection/exe_v2h/yolov3_onnx/preprocess/addr_map.txt
@@ -3,10 +3,10 @@ data 12c000 279c00
data_out 3a5c00 1fb000
work 5a0c00 80
weight 5a0c80 80
-drp_config 5a0d00 f3bc0
-aimac_param_cmd 6948c0 20
-aimac_param_desc 694900 10
-aimac_cmd 694940 180
-aimac_desc 694ac0 50
-drp_param 694b80 f0
-drp_desc 694c80 110
+drp_config 5a0d00 efe10
+aimac_param_cmd 690b40 20
+aimac_param_desc 690b80 10
+aimac_cmd 690bc0 180
+aimac_desc 690d40 50
+drp_param 690e00 f0
+drp_desc 690f00 110
diff --git a/R01_object_detection/exe_v2h/yolov3_onnx/preprocess/aimac_desc.bin b/R01_object_detection/exe_v2h/yolov3_onnx/preprocess/aimac_desc.bin
index c094b76..1dddd62 100755
Binary files a/R01_object_detection/exe_v2h/yolov3_onnx/preprocess/aimac_desc.bin and b/R01_object_detection/exe_v2h/yolov3_onnx/preprocess/aimac_desc.bin differ
diff --git a/R01_object_detection/exe_v2h/yolov3_onnx/preprocess/aimac_param_desc.bin b/R01_object_detection/exe_v2h/yolov3_onnx/preprocess/aimac_param_desc.bin
index fc9e2f9..9cbd219 100755
Binary files a/R01_object_detection/exe_v2h/yolov3_onnx/preprocess/aimac_param_desc.bin and b/R01_object_detection/exe_v2h/yolov3_onnx/preprocess/aimac_param_desc.bin differ
diff --git a/R01_object_detection/exe_v2h/yolov3_onnx/preprocess/drp_config.mem b/R01_object_detection/exe_v2h/yolov3_onnx/preprocess/drp_config.mem
index 5239a14..5306834 100755
Binary files a/R01_object_detection/exe_v2h/yolov3_onnx/preprocess/drp_config.mem and b/R01_object_detection/exe_v2h/yolov3_onnx/preprocess/drp_config.mem differ
diff --git a/R01_object_detection/exe_v2h/yolov3_onnx/preprocess/drp_desc.bin b/R01_object_detection/exe_v2h/yolov3_onnx/preprocess/drp_desc.bin
index 6d48660..81c59e3 100755
Binary files a/R01_object_detection/exe_v2h/yolov3_onnx/preprocess/drp_desc.bin and b/R01_object_detection/exe_v2h/yolov3_onnx/preprocess/drp_desc.bin differ
diff --git a/R01_object_detection/exe_v2h/yolov3_onnx_fhd/deploy.json b/R01_object_detection/exe_v2h/yolov3_onnx_fhd/deploy.json
index 7d1ceb3..b8df01e 100755
--- a/R01_object_detection/exe_v2h/yolov3_onnx_fhd/deploy.json
+++ b/R01_object_detection/exe_v2h/yolov3_onnx_fhd/deploy.json
@@ -7,14 +7,14 @@
},
{
"op": "tvm_op",
- "name": "tvmgen_default_tvmgen_default_tvmgen_default_mera_drp_main_0",
+ "name": "tvmgen_default_tvmgen_default_mera_drp_main_0",
"attrs": {
"flatten_data": "0",
- "func_name": "tvmgen_default_tvmgen_default_tvmgen_default_mera_drp_main_0",
- "hash": "8204a5bc4fae0685",
+ "func_name": "tvmgen_default_tvmgen_default_mera_drp_main_0",
+ "hash": "eb1640a6874236c6",
"num_outputs": "3",
"num_inputs": "1",
- "global_symbol": "tvmgen_default_tvmgen_default_tvmgen_default_mera_drp_main_0",
+ "global_symbol": "tvmgen_default_tvmgen_default_mera_drp_main_0",
"Compiler": "mera_drp"
},
"inputs": [
diff --git a/R01_object_detection/exe_v2h/yolov3_onnx_fhd/preprocess/addr_map.txt b/R01_object_detection/exe_v2h/yolov3_onnx_fhd/preprocess/addr_map.txt
index 7888f92..6d6b5d2 100755
--- a/R01_object_detection/exe_v2h/yolov3_onnx_fhd/preprocess/addr_map.txt
+++ b/R01_object_detection/exe_v2h/yolov3_onnx_fhd/preprocess/addr_map.txt
@@ -3,10 +3,10 @@ data a8c000 279c00
data_out d05c00 1fb000
work f00c00 80
weight f00c80 80
-drp_config f00d00 f3bc0
-aimac_param_cmd ff48c0 20
-aimac_param_desc ff4900 10
-aimac_cmd ff4940 180
-aimac_desc ff4ac0 50
-drp_param ff4b80 f0
-drp_desc ff4c80 110
+drp_config f00d00 efe10
+aimac_param_cmd ff0b40 20
+aimac_param_desc ff0b80 10
+aimac_cmd ff0bc0 180
+aimac_desc ff0d40 50
+drp_param ff0e00 f0
+drp_desc ff0f00 110
diff --git a/R01_object_detection/exe_v2h/yolov3_onnx_fhd/preprocess/aimac_desc.bin b/R01_object_detection/exe_v2h/yolov3_onnx_fhd/preprocess/aimac_desc.bin
index 2ab30d2..d6db481 100755
Binary files a/R01_object_detection/exe_v2h/yolov3_onnx_fhd/preprocess/aimac_desc.bin and b/R01_object_detection/exe_v2h/yolov3_onnx_fhd/preprocess/aimac_desc.bin differ
diff --git a/R01_object_detection/exe_v2h/yolov3_onnx_fhd/preprocess/aimac_param_desc.bin b/R01_object_detection/exe_v2h/yolov3_onnx_fhd/preprocess/aimac_param_desc.bin
index cdbbfc8..4fc85e8 100755
Binary files a/R01_object_detection/exe_v2h/yolov3_onnx_fhd/preprocess/aimac_param_desc.bin and b/R01_object_detection/exe_v2h/yolov3_onnx_fhd/preprocess/aimac_param_desc.bin differ
diff --git a/R01_object_detection/exe_v2h/yolov3_onnx_fhd/preprocess/drp_config.mem b/R01_object_detection/exe_v2h/yolov3_onnx_fhd/preprocess/drp_config.mem
index 5239a14..5306834 100755
Binary files a/R01_object_detection/exe_v2h/yolov3_onnx_fhd/preprocess/drp_config.mem and b/R01_object_detection/exe_v2h/yolov3_onnx_fhd/preprocess/drp_config.mem differ
diff --git a/R01_object_detection/exe_v2h/yolov3_onnx_fhd/preprocess/drp_desc.bin b/R01_object_detection/exe_v2h/yolov3_onnx_fhd/preprocess/drp_desc.bin
index 6d8938b..ca63e18 100755
Binary files a/R01_object_detection/exe_v2h/yolov3_onnx_fhd/preprocess/drp_desc.bin and b/R01_object_detection/exe_v2h/yolov3_onnx_fhd/preprocess/drp_desc.bin differ
diff --git a/R01_object_detection/img/objectdetection.png b/R01_object_detection/img/objectdetection.png
index 97061c7..bdd2cc6 100755
Binary files a/R01_object_detection/img/objectdetection.png and b/R01_object_detection/img/objectdetection.png differ
diff --git a/R01_object_detection/img/objectdetection_v2h.jpg b/R01_object_detection/img/objectdetection_v2h.jpg
new file mode 100755
index 0000000..27ad2d9
Binary files /dev/null and b/R01_object_detection/img/objectdetection_v2h.jpg differ
diff --git a/R01_object_detection/img/objectdetection_v2h.png b/R01_object_detection/img/objectdetection_v2h.png
deleted file mode 100755
index 0bd9807..0000000
Binary files a/R01_object_detection/img/objectdetection_v2h.png and /dev/null differ
diff --git a/R01_object_detection/src_v2h/MeraDrpRuntimeWrapper.cpp b/R01_object_detection/src_v2h/MeraDrpRuntimeWrapper.cpp
index ff005a8..d92af3c 100755
--- a/R01_object_detection/src_v2h/MeraDrpRuntimeWrapper.cpp
+++ b/R01_object_detection/src_v2h/MeraDrpRuntimeWrapper.cpp
@@ -1,6 +1,6 @@
/*
* Original Code (C) Copyright Edgecortix, Inc. 2022
- * Modified Code (C) Copyright Renesas Electronics Corporation 2023
+ * Modified Code (C) Copyright Renesas Electronics Corporation 2023
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -136,6 +136,10 @@ void MeraDrpRuntimeWrapper::Run() {
mod.GetFunction("run")();
}
+void MeraDrpRuntimeWrapper::Run(int freq_index) {
+ mod.GetFunction("run")(freq_index);
+}
+
void MeraDrpRuntimeWrapper::ProfileRun(const std::string& profile_table, const std::string& profile_csv) {
tvm::runtime::PackedFunc profile = mod.GetFunction("profile");
tvm::runtime::Array collectors;
@@ -152,6 +156,22 @@ void MeraDrpRuntimeWrapper::ProfileRun(const std::string& profile_table, const s
ofs_csv.close();
}
+void MeraDrpRuntimeWrapper::ProfileRun(const std::string& profile_table, const std::string& profile_csv, int freq_index) {
+ tvm::runtime::PackedFunc profile = mod.GetFunction("profile");
+ tvm::runtime::Array collectors;
+ tvm::runtime::profiling::Report report = profile(collectors, freq_index);
+
+ std::string rep_table = report->AsTable();
+ std::ofstream ofs_table (profile_table, std::ofstream::out);
+ ofs_table << rep_table << std::endl;
+ ofs_table.close();
+
+ std::string rep_csv = report->AsCSV();
+ std::ofstream ofs_csv (profile_csv, std::ofstream::out);
+ ofs_csv << rep_csv << std::endl;
+ ofs_csv.close();
+}
+
int MeraDrpRuntimeWrapper::GetNumInput(std::string model_dir) {
// TVM does not support api to get number input of model.
// This function calculate input number base on convention
diff --git a/R01_object_detection/src_v2h/MeraDrpRuntimeWrapper.h b/R01_object_detection/src_v2h/MeraDrpRuntimeWrapper.h
index 5f1b2be..8e2465f 100755
--- a/R01_object_detection/src_v2h/MeraDrpRuntimeWrapper.h
+++ b/R01_object_detection/src_v2h/MeraDrpRuntimeWrapper.h
@@ -1,6 +1,6 @@
/*
* Original Code (C) Copyright Edgecortix, Inc. 2022
- * Modified Code (C) Copyright Renesas Electronics Corporation 2023
+ * Modified Code (C) Copyright Renesas Electronics Corporation 2023
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -38,7 +38,9 @@ class MeraDrpRuntimeWrapper {
template
void SetInput(int input_index, const T* data_ptr);
void Run();
+ void Run(int freq_index);
void ProfileRun(const std::string& profile_table, const std::string& profile_csv);
+ void ProfileRun(const std::string& profile_table, const std::string& profile_csv, int freq_index);
int GetNumInput(std::string model_dir);
InOutDataType GetInputDataType(int index);
int GetNumOutput();
diff --git a/R01_object_detection/src_v2h/PreRuntime.h b/R01_object_detection/src_v2h/PreRuntime.h
index ecd4e40..af2e9a6 100755
--- a/R01_object_detection/src_v2h/PreRuntime.h
+++ b/R01_object_detection/src_v2h/PreRuntime.h
@@ -1,6 +1,6 @@
/*
* Original Code (C) Copyright Renesas Electronics Corporation 2023
- *
+ *
* *1 DRP-AI TVM is powered by EdgeCortix MERA(TM) Compiler Framework.
*
* Licensed to the Apache Software Foundation (ASF) under one
diff --git a/R01_object_detection/src_v2h/PreRuntimeV2H.cpp b/R01_object_detection/src_v2h/PreRuntimeV2H.cpp
index e0e69e8..764074a 100755
--- a/R01_object_detection/src_v2h/PreRuntimeV2H.cpp
+++ b/R01_object_detection/src_v2h/PreRuntimeV2H.cpp
@@ -1,6 +1,6 @@
/*
* Original Code (C) Copyright Renesas Electronics Corporation 2023
- *
+ *
* *1 DRP-AI TVM is powered by EdgeCortix MERA(TM) Compiler Framework.
*
* Licensed to the Apache Software Foundation (ASF) under one
diff --git a/R01_object_detection/src_v2h/define.h b/R01_object_detection/src_v2h/define.h
index 76712bf..a506f40 100755
--- a/R01_object_detection/src_v2h/define.h
+++ b/R01_object_detection/src_v2h/define.h
@@ -182,19 +182,10 @@ const static uint32_t INF_OUT_SIZE = (NUM_CLASS + 5) * NUM_BB * num_grids[0] *
/*For termination method display*/
#define TEXT_START_X (1440)
-/* DRP_MAX_FREQ and DRPAI_FREQ are the */
-/* frequency settings for DRP-AI. */
+/* DRPAI_FREQ is the frequency settings */
+/* for DRP-AI. */
/* Basically use the default values */
-#define DRP_MAX_FREQ (2)
-/* DRP_MAX_FREQ can be set from 2 to 127 */
-/* 2: 420MHz */
-/* 3: 315MHz */
-/* ... */
-/* 127: 9.84MHz */
-/* Calculation Formula: */
-/* 1260MHz /(DRP_MAX_FREQ + 1) */
-
#define DRPAI_FREQ (2)
/* DRPAI_FREQ can be set from 1 to 127 */
/* 1,2: 1GHz */
diff --git a/R01_object_detection/src_v2h/main.cpp b/R01_object_detection/src_v2h/main.cpp
index 25c6b76..a6b6bc9 100755
--- a/R01_object_detection/src_v2h/main.cpp
+++ b/R01_object_detection/src_v2h/main.cpp
@@ -115,7 +115,6 @@ static uint32_t array_cap_time[30] = {1000,1000,1000,1000,1000,1000,1000,1000,10
#endif /* DISP_CAM_FRAME_RATE */
/*DRP-AI Frequency setting*/
-static int32_t drp_max_freq;
static int32_t drpai_freq;
static Wayland wayland;
@@ -712,7 +711,7 @@ void *R_Inf_Thread(void *threadid)
goto err;
}
- runtime.Run();
+ runtime.Run(drpai_freq);
/*Gets AI Inference End Time*/
ret = timespec_get(&inf_end_time, TIME_UTC);
@@ -1187,38 +1186,6 @@ uint64_t get_drpai_start_addr(int drpai_fd)
return drpai_data.address;
}
-/*****************************************
-* Function Name : set_drpai_freq
-* Description : Function to set the DRP and DRP-AI frequency.
-* Arguments : drpai_fd: DRP-AI file descriptor
-* Return value : 0 if succeeded
-* not 0 otherwise
-******************************************/
-int set_drpai_freq(int drpai_fd)
-{
- int ret = 0;
- uint32_t data;
-
- errno = 0;
- data = drp_max_freq;
- ret = ioctl(drpai_fd , DRPAI_SET_DRP_MAX_FREQ, &data);
- if (-1 == ret)
- {
- fprintf(stderr, "[ERROR] Failed to set DRP Max Frequency : errno=%d\n", errno);
- return -1;
- }
-
- errno = 0;
- data = drpai_freq;
- ret = ioctl(drpai_fd , DRPAI_SET_DRPAI_FREQ, &data);
- if (-1 == ret)
- {
- fprintf(stderr, "[ERROR] Failed to set DRP-AI Frequency : errno=%d\n", errno);
- return -1;
- }
- return 0;
-}
-
/*****************************************
* Function Name : init_drpai
* Description : Function to initialize DRP-AI.
@@ -1239,13 +1206,6 @@ uint64_t init_drpai(int drpai_fd)
return 0;
}
- /*Set DRP-AI frequency*/
- ret = set_drpai_freq(drpai_fd);
- if (ret != 0)
- {
- return 0;
- }
-
return drpai_addr;
}
@@ -1266,6 +1226,8 @@ int32_t main(int32_t argc, char * argv[])
bool runtime_status = false;
int drpai_fd;
+ uint64_t drpaimem_addr_start = 0;
+
std::string media_port = query_device_status("usb");
gstreamer_pipeline = "v4l2src device=" + media_port +" ! video/x-raw, width="+std::to_string(CAM_IMAGE_WIDTH)+", height="+std::to_string(CAM_IMAGE_HEIGHT)+" ,framerate=30/1 ! videoconvert ! appsink -v";
@@ -1282,25 +1244,22 @@ int32_t main(int32_t argc, char * argv[])
/* Usually, users can use default values. */
if (2 <= argc)
{
- drp_max_freq = atoi(argv[1]);
- printf("Argument : = %d\n", drp_max_freq);
- }
- else
- {
- drp_max_freq = DRP_MAX_FREQ;
- }
- if (3 <= argc)
- {
- drpai_freq = atoi(argv[2]);
- printf("Argument : = %d\n", drpai_freq);
+ drpai_freq = atoi(argv[1]);
+ if ((1 <= drpai_freq) && (127 >= drpai_freq))
+ {
+ printf("Argument : = %d\n", drpai_freq);
+ }
+ else
+ {
+ fprintf(stderr,"[ERROR] Invalid Command Line Argument : =%d\n", drpai_freq);
+ goto end_main;
+ }
}
else
{
drpai_freq = DRPAI_FREQ;
}
- uint64_t drpaimem_addr_start = 0;
-
/*Load Label from label_list file*/
label_file_map = load_label_file(label_list);
if (label_file_map.empty())