### EasyDL Demo Project Setup and Run (npm) Source: https://cloud.baidu.com/doc/EASYDL/s/Gl39rebrx Instructions for setting up and running an EasyDL demo project using Node.js and npm. This includes installing dependencies and starting the development server. ```bash npm install npm run dev ``` -------------------------------- ### Demo Setup and Compilation Source: https://cloud.baidu.com/doc/EASYDL/s/ekkw0i4jc Instructions for setting up the demo environment, including sourcing OpenVINO scripts, obtaining serial numbers, and compiling the demo application. ```APIDOC ## Demo Setup and Compilation ### Description Instructions for setting up the demo environment, including sourcing OpenVINO scripts, obtaining serial numbers, and compiling the demo application. ### Method N/A (Setup Instructions) ### Endpoint N/A (Setup Instructions) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example ```bash # Source OpenVINO setup script (if applicable) source ${cpp_kit位置路径}/thirdparty/openvino/bin/setupvars.sh # Navigate to SDK directory cd src mkdir build && cd build cmake .. && make # Run image inference (CPU) ./easyedge_image_inference {模型RES文件夹} {测试图片路径} # Run image inference (NNIE Engine - requires sudo) sudo ./easyedge_image_inference {模型RES文件夹} {测试图片路径} # To enable automatic OpenCV compilation: cmake -DEDGE_BUILD_OPENCV=ON ``` ### Response #### Success Response (200) N/A (Compilation and execution output) #### Response Example ``` 2019-02-13 16:46:12,659 INFO [EasyEdge] [easyedge.cpp:34] 140606189016192 Baidu EasyEdge Linux Development Kit 0.2.1(20190213) 2019-02-13 16:46:14,083 INFO [EasyEdge] [paddlev2_edge_predictor.cpp:60] 140606189016192 Allocate graph success. 2019-02-13 16:46:14,326 DEBUG [EasyEdge] [paddlev2_edge_predictor.cpp:143] 140606189016192 Inference costs 168 ms 1, 1:txt_frame, p:0.994905 loc: 0.168161, 0.153654, 0.920856, 0.779621 Done ``` ``` -------------------------------- ### Get MongoDB Slow Log Trend API Request Example Source: https://cloud.baidu.com/doc/DBSC/s/am3i6mrhh An example of a complete HTTP GET request to the DBSC API for fetching MongoDB slow log trends. This example includes specific values for appId, nodeId, start, end, and period, along with an authorization header. ```http GET /v1/diagnosis/mongodb/slowlog/trend?appId=m-YPG8VL&nodeId=node-htILmc&start=2024-11-11T02:28:27Z&end=2024-11-11T02:58:27Z&period=3600 HTTP/1.1 Host: dbsc.bj.baidubce.com Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2023-07-11T11:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de ``` -------------------------------- ### C++ SDK Setup Source: https://cloud.baidu.com/doc/EASYDL/s/Bk7q4e4u5 Instructions for setting up the C++ SDK, including environment configuration and device setup. ```APIDOC ## C++ SDK Setup ### Description Instructions for setting up the C++ SDK, including copying SDK files, sourcing environment scripts, and configuring USB rules for device detection. ### Setup Steps 1. **Copy SDK:** Copy the entire SDK package to the target host machine. 2. **Extract and Compile:** Uncompress the SDK and compile your application. 3. **Source Environment Script:** Before compiling or running demo programs, execute: ```bash source ${cpp_kit位置路径}/thirdparty/openvino/bin/setupvars.sh ``` 4. **Configure USB Rules (if device not found):** ```bash sudo cp ${cpp_kit位置路径}/thirdparty/openvino/deployment_tools/inference_engine/external/97-myriad-usbboot.rules /etc/udev/rules.d/ sudo udevadm control --reload-rules sudo udevadm trigger sudo ldconfig ``` ``` -------------------------------- ### General Reference Source: https://cloud.baidu.com/doc/BCC/s/Yjwvyn42a General reference materials including getting started guides, authentication mechanisms, and terms of service. ```APIDOC ## General Reference * ICP Filing Help * Region Selection Guide * Authentication Mechanism * Getting AK/SK * Glossary * Legal Terms * API Getting Started Guide ``` -------------------------------- ### Get MySQL Instance Slow Log Trend API Request Example Source: https://cloud.baidu.com/doc/DBSC/s/ym3i7t06j An example HTTP GET request for the MySQL slow log trend API. This shows concrete values for `appId`, `nodeId`, `period`, `start`, `end`, and `Authorization`, illustrating a typical usage scenario. ```HTTP GET /v1/diagnosis/mysql/slowlog/trend?appId=rds-0mxm0cTI&nodeId=rds-0mxm0cTI&period=3600&start=2024-11-12T00:00:00Z&end=2024-11-12T12:00:00Z HTTP/1.1 Host: dbsc.bj.baidubce.com Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2023-07-11T11:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de ``` -------------------------------- ### Set up Preview and Start Recording (Objective-C) Source: https://cloud.baidu.com/doc/VideoCreatingSDK/s/vki8bhjri Illustrates the process of initializing the capture configuration, obtaining the preview view, setting its frame, assigning a delegate, and adding it to the view hierarchy. It also covers starting the recording process with a specified path and callback. ```Objective-C // Use settings to create capture configuration _avStreamContext = [_avStreamContext initWithCaptureConfig:settings]; // Get the capture view UIView *preview = _avStreamContext.view; // Set preview view frame preview.frame = self.view.bounds; // Set capture delegate _avStreamContext.delegate = self; // Add preview view to the controller [self.view insertSubview:preview atIndex:0]; // Start preview (checks camera and microphone permissions) [[BDCloudAVStreamContext sharedInstance] startPreview]; // Start recording NSString *recordVideoPath = @"your_record_path.mp4"; // Replace with actual path [[BDCloudAVStreamContext sharedInstance] startRecording:recordVideoPath recordCallBack:^(BDCloudAVStreamFileOutputState state, double recordSecond, NSError *error) { // Handle recording state callbacks switch (state) { case BDCloudAVStreamFileOutputStateStarting: // Starting recording break; case BDCloudAVStreamFileOutputStateStarted: // Recording started break; case BDCloudAVStreamFileOutputStateCancel: // Recording cancelled break; case BDCloudAVStreamFileOutputStateError: // Handle errors NSLog(@"Recording error: %@", error); break; case BDCloudAVStreamFileOutputStateEnding: // Recording ending break; case BDCloudAVStreamFileOutputStateEnded: // Recording ended break; default: break; } }]; ``` -------------------------------- ### Preview Configuration and Setup Source: https://cloud.baidu.com/doc/VideoCreatingSDK/s/vki8bhjri Guides through setting up the preview before recording, including creating the capture instance, obtaining the preview view, and adding it to the view controller. ```APIDOC ## Preview Configuration and Setup ### Description This section details the steps required to configure and set up the preview screen before starting video recording. It involves initializing the capture configuration, getting the preview view, setting its frame, assigning a delegate, and adding it to the view hierarchy. ### Method Initialization: `initWithCaptureConfig:` ### Endpoint N/A (This is an SDK method call) ### Parameters * **settings** (`BDCloudAVStreamSettings`) - Required - The configuration settings for the capture. ### Request Example ```objectivec // Assuming _avStreamContext is already initialized as a singleton // And settings is an instance of BDCloudAVStreamSettings _avStreamContext = [_avStreamContext initWithCaptureConfig:settings]; // Get the preview view UIView *preview = _avStreamContext.view; // Set the frame for the preview view preview.frame = self.view.bounds; // Set the delegate for the capture context _avStreamContext.delegate = self; // Add the preview view to the view controller's view [self.view insertSubview:preview atIndex:0]; ``` ### Response N/A (Modifies the UI and sets up the capture context. ``` -------------------------------- ### GET /certificates Source: https://cloud.baidu.com/doc/Reference/s/ejwvz29ci Retrieves a list of all certificates associated with your account, including their metadata. ```APIDOC ## GET /certificates ### Description Retrieves a list of all certificates managed under your account. This endpoint does not require any request parameters. ### Method `GET` ### Endpoint `/certificates` ### Parameters #### Query Parameters None ### Request Example ```java // Issue the request CertListResponse listResponse = certClient.listUserCerts(); ``` ### Response #### Success Response (200) - **certs** (List) - A list containing metadata for each certificate. **CertificateMeta Object Attributes:** - **certId** (String) - The unique identifier for the certificate. - **certName** (String) - The name of the certificate. - **certCommonName** (String) - The common name of the certificate (e.g., the domain name). - **certStartTime** (DateTime) - The date and time the certificate becomes effective. - **certStopTime** (DateTime) - The date and time the certificate expires. - **certCreateTime** (DateTime) - The date and time the certificate was created. - **certUpdateTime** (DateTime) - The date and time the certificate was last updated. #### Response Example ```json { "certs": [ { "certId": "crt-xxxxxxxxxxxx", "certName": "MyDomain.com", "certCommonName": "*.example.com", "certStartTime": "2023-10-27T10:00:00Z", "certStopTime": "2024-10-27T10:00:00Z", "certCreateTime": "2023-10-27T09:00:00Z", "certUpdateTime": "2023-10-27T09:00:00Z" } ] } ``` ``` -------------------------------- ### Get PostgreSQL Slow Log Trend Request Example Source: https://cloud.baidu.com/doc/DBSC/s/Imaf0hym9 This code snippet shows an example HTTP GET request to the /api/v1/diagnosis/postgresql/slowlog/trend endpoint. It includes parameters for product, appId, nodeId, start time, end time, and period. The request requires a Host header and Authorization header for authentication. ```http GET /api/v1/diagnosis/postgresql/slowlog/trend?product=rds&appId=rdsmte2lk8ap0sl&nodeId=i-node1&start=2023-06-01T00:00:00Z&end=2023-06-02T00:00:00Z&period=3600 HTTP/1.1 Host: dbsc.bj.baidu.com Content-Type: application/json Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2023-07-11T11:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de ``` -------------------------------- ### Install and Start VNC Server (Ubuntu) Source: https://cloud.baidu.com/doc/BCC/s/tkc04iv52 Installs the VNC server package, starts the service, and configures the connection password. It also includes commands to verify the service status and identify the port used. ```bash apt-get -y install vnc4server vnc4server ps -ef | grep vnc ``` -------------------------------- ### Baidu Cloud Monitoring API Request Example Source: https://cloud.baidu.com/doc/BCM/s/9jwvym3kb Example of a GET request to the Baidu Cloud monitoring API to retrieve metric data. It includes parameters for instance ID, statistics, period, start time, and end time. ```http GET /json-api/v1/metricdata/fakeuser1ba678asdf8as7df6a5sdf67/BCE_BCC/CpuIdlePercent?dimensions=InstanceId:fakeid-2222-8888-1111-13a8469b1fb2&statistics[]=average,maximum,minimum&periodInSecond=60&startTime=2019-04-16T13:55:01Z&endTime=2019-04-16T14:00:01Z HTTP/1.1 Host: bcm.bj.baidubce.com:80 ``` -------------------------------- ### Running the HTTP Serving Demo Source: https://cloud.baidu.com/doc/EASYDL/s/Ok3qy9a2j Instructions for setting up and running the HTTP serving demo for real-time inference. ```APIDOC ## Running the HTTP Serving Demo ### Description This section describes how to launch an HTTP server for performing inference requests. After starting the server, you can use a web browser or HTTP client to send images or videos for prediction. ### Method ```bash python3 demo_serving.py {model_dir} {serial_key} {host, default 0.0.0.0} {port, default 24401} ``` ### Output Upon successful execution, the server will display: ``` Running on http://0.0.0.0:24401/ ``` ### Accessing the Service You can access the service by opening a web browser to `http://{device_ip}:{port}` or by using an HTTP client to send requests. Refer to the `http_client_test()` function in `demo_serving.py` for an example of making HTTP requests. ### Parameters - **model_dir**: Path to the directory containing the model (default: `RES`). - **serial_key**: Your license serial key. - **host**: The host address to bind the server to (default: `0.0.0.0`). - **port**: The port number for the server (default: `24401`). ``` -------------------------------- ### Request Example: Get Multiple Domain Logs (JSON) Source: https://cloud.baidu.com/doc/CDN/s/cjwvyf0r9 This is a JSON request example for the `/v2/log/list` endpoint to query log download addresses for specified domains and time ranges. It includes parameters like log type, domain list, start and end times, and pagination. ```json { "type":2, "domains":[ "xiao01097.baidu.com" ], "startTime":"2019-03-04T00:00:00Z", "endTime":"2019-03-04T23:00:00Z", "pageNo":1, "pageSize":1000 } ``` -------------------------------- ### Kafka and S3 Sink Connector Installation and Setup Source: https://cloud.baidu.com/doc/BOS/s/Mm0djl8mm This snippet demonstrates the initial setup for Kafka and the S3 Sink Connector. It includes downloading Kafka, creating a plugins directory, starting Zookeeper and Kafka services, downloading the S3 Sink Connector, and placing it into the Kafka plugins directory. ```shell # Download and install Kafka, create plugins directory tar zxvf kafka_2.13-3.6.2.tgz cd kafka_2.13-3.6.2 mkdir -p plugins # Start Zookeeper bin/zookeeper-server-start.sh config/zookeeper.properties # Start Kafka bin/kafka-server-start.sh config/server.properties # Download and install S3 Sink Connector, place in Kafka plugins directory unzip confluentinc-kafka-connect-s3-10.5.0.zip cp -r confluentinc-kafka-connect-s3-10.5.0 kafka_2.13-3.6.2/plugins ``` -------------------------------- ### EdgeKit Serving Startup Source: https://cloud.baidu.com/doc/EASYDL/s/Vlhpxrnay This section describes how to start the EdgeKit Serving service using command-line arguments or a configuration file. ```APIDOC ## EdgeKit Serving Startup ### Description This endpoint allows for the startup of the EdgeKit Serving service. Configuration can be provided via command-line flags or a YAML configuration file. Command-line arguments will override settings in the configuration file. ### Method N/A (Command-line execution) ### Endpoint N/A (Command-line execution) ### Parameters #### Command-line Flags - **--help** (boolean) - Displays help information. - **-c, --cfg** (string) - Path to the configuration file (default: `./edgekit_serving.yml`). - **-m, --model_dir** (string) - Directory containing the models (default: `./RES`). - **-s, --serial_num** (string) - Serial number for the service. - **--pool_min_size** (integer) - Minimum number of predictors in the prediction pool (default: 1). - **--pool_max_size** (integer) - Maximum number of predictors in the prediction pool (default: 1). - **--pool_full_interval_seconds** (integer) - Interval in seconds for scaling up the prediction pool when full (default: -1). - **--pool_idle_interval_seconds** (integer) - Interval in seconds for scaling down the prediction pool when idle (default: -1). - **--pool_available_device** (integer) - List of available devices for the prediction pool (default: -1). - **-d, --debug** (boolean) - Enables debug mode. - **--log_to_std** (boolean) - Logs output to standard output. - **--log_to_file** (boolean) - Logs output to a file. - **--log_file** (string) - Name of the log file (default: `easyedge.log`). - **--log_max_size** (integer) - Maximum log file size in MB (default: 10). - **--log_max_age** (integer) - Maximum age of log files in days (default: 10). - **--log_max_backups** (integer) - Maximum number of old log files to keep (default: 100). - **-h, --host** (string) - Host address for the service (default: `127.0.0.1`). - **-p, --port** (integer) - Port for the service (default: 24401). - **--ws_max_handle_num** (integer) - Maximum number of concurrent WebSocket requests (default: 1). - **--ws_max_handle_timeout** (integer) - Timeout for WebSocket requests in seconds (default: 30). #### Configuration File (YAML) ```yaml controller: serialNum: AAAA-AAAA-AAAA-AAAA # Serial number modelDir: ../../../RES # Model directory predictorPool: minSize: 1 # Min predictors in pool maxSize: 3 # Max predictors in pool fullIntervalSeconds: 1 # Scale-up interval when pool is full idleIntervalSeconds: 1 # Scale-down interval when pool is idle availableDevice: [ -1 ] # Available devices for the pool serving: host: 0.0.0.0 # Service host address port: 24401 # Service port enableHTTP: true # Enable HTTP service enableWS: false # Enable WebSocket service ws: maxHandleNum: 1 # Max concurrent WebSocket requests maxHandleTimeout: 30 # WebSocket request timeout logging: debug: true # Enable debug mode logToStd: true # Log to standard output logToFile: false # Log to file logFile: easyedge.log # Log file name maxSize: 10 # Max log file size (MB) maxAge: 10 # Max log file age (days) maxBackups: 100 # Max old log files ``` ### Request Example ```bash ./edgekit_serving -c config.yml -m ./models ``` ### Response N/A (Service startup is a command-line operation.) ``` -------------------------------- ### Driver Interface Definition (Go) Source: https://cloud.baidu.com/doc/BIE/s/4ljwr31e0 Defines the core Driver interface for custom gateway drivers. It outlines essential methods for driver management, configuration, and device interaction, including getting driver information, setting configuration, setup, starting, stopping, restarting, getting, and setting device data. ```Go type Driver interface { // GetDriverInfo 获取驱动信息 GetDriverInfo(req *Request) (*Response, error) // SetConfig 配置驱动,目前只配置了驱动的配置文件路径 SetConfig(req *Request) (*Response, error) // Setup 宿主进程上报接口传递,必须调用下述逻辑,其余可用户自定义 Setup(config *BackendConfig) (*Response, error) // Start 驱动采集启动,用户自定义实现 Start(req *Request) (*Response, error) // Restart 驱动重启,用户自定义实现 Restart(req *Request) (*Response, error) // Stop 驱动停止,用户自定义实现 Stop(req *Request) (*Response, error) // Get 召测,用户自定义实现 Get(req *Request) (*Response, error) // Set 置数,用户自定义实现 Set(req *Request) (*Response, error) } ``` -------------------------------- ### VNC Server First-Time Setup Prompt (Text) Source: https://cloud.baidu.com/doc/DUMU/s/4lnmyg8pp This text illustrates the interactive prompts encountered when starting a VNC server for the first time, including setting a password, a view-only password, and confirmation of the new desktop session. ```text You will require a password to access your desktops. Password: Verify: Would you like to enter a view-only password (y/n)? n New 'paddlepi:1 (edgeboard)' desktop at :1 on machine paddlepi Starting applications specified in /etc/X11/Xvnc-session Log file is /home/edgeboard/.vnc/paddlepi:1.log Use xtigervncviewer -SecurityTypes VncAuth,TLSVnc -passwd /home/edgeboard/.vnc/passwd paddlepi:1 to connect to the VNC server. ``` -------------------------------- ### Node.js Example - Get Access Token Source: https://cloud.baidu.com/doc/IMAGEPROCESS/s/2k3bclou0 Example Node.js code to get an access token from Baidu Cloud. ```APIDOC ## Node.js Example ### Description This Node.js code uses the https module to make a GET request to the Baidu Cloud API to retrieve an access token. It constructs the query string and pipes the response to stdout. ### Method GET ### Endpoint `https://aip.baidubce.com/oauth/2.0/token?grant_type=client_credentials&client_id=[YOUR_API_KEY]&client_secret=[YOUR_SECRET_KEY]` ### Parameters #### Query Parameters - **grant_type** (string) - Required - Must be 'client_credentials' - **client_id** (string) - Required - Your API Key - **client_secret** (string) - Required - Your Secret Key ### Request Example ```javascript // Node.js code { 'grant_type': 'client_credentials', 'client_id': 'YOUR_API_KEY', 'client_secret': 'YOUR_SECRET_KEY' } ``` ### Response #### Success Response (200) - **access_token** (string) - The access token. - **expires_in** (integer) - The token's expiration time in seconds. #### Response Example ```json { "access_token": "YOUR_ACCESS_TOKEN", "expires_in": 2592000 } ``` ``` -------------------------------- ### Starting HTTP Service Source: https://cloud.baidu.com/doc/BML/s/vkhys2sf6 This demonstrates how to start the HTTP service included in the SDK deployment package. The service allows for testing model effects via a web browser and offers HTTP interfaces for interaction. It requires specifying the resource directory, host, and port. ```bash # ./easyedge_serving {RES目录} "" {绑定的host,默认0.0.0.0} {绑定的端口,默认24401} cd ${SDK_ROOT} export LD_LIBRARY_PATH=./lib ./demo/easyedge_serving ../../../RES "" ``` -------------------------------- ### C# Example - Get Access Token Source: https://cloud.baidu.com/doc/IMAGEPROCESS/s/2k3bclou0 Example C# code to get an access token from Baidu Cloud. ```APIDOC ## C# Example ### Description This C# code snippet shows how to retrieve an access token using the HttpClient class. It constructs the request, sends it to the Baidu Cloud API, and processes the JSON response. ### Method POST ### Endpoint `https://aip.baidubce.com/oauth/2.0/token` ### Parameters #### Request Body - **grant_type** (string) - Required - Must be 'client_credentials' - **client_id** (string) - Required - Your API Key - **client_secret** (string) - Required - Your Secret Key ### Request Example ```csharp // C# code { "grant_type": "client_credentials", "client_id": "YOUR_API_KEY", "client_secret": "YOUR_SECRET_KEY" } ``` ### Response #### Success Response (200) - **access_token** (string) - The access token. - **expires_in** (integer) - The token's expiration time in seconds. #### Response Example ```json { "access_token": "YOUR_ACCESS_TOKEN", "expires_in": 2592000 } ``` ``` -------------------------------- ### Start Preview Source: https://cloud.baidu.com/doc/VideoCreatingSDK/s/vki8bhjri Describes the `startPreview` interface, which initiates the camera and microphone preview after all configurations are set. ```APIDOC ## Start Preview ### Description Initiates the camera and microphone preview. This interface checks for user permissions for the camera and microphone before starting the preview. ### Method `startPreview` ### Endpoint N/A (This is an SDK method call) ### Parameters None. ### Request Example ```objectivec [[BDCloudAVStreamContext sharedInstance] startPreview]; ``` ### Response N/A. The action starts the preview. ``` -------------------------------- ### Query Specific Stream Data - Request Example Source: https://cloud.baidu.com/doc/LSS/s/bjwvyyujl This example demonstrates how to construct a GET request to query specific stream data. It includes essential parameters such as the API version, domain, app, stream name, start date, end date, and an option to aggregate results. ```plaintext GET /v5/statistics/domain/demo.domain.com/app/myapp/stream/mystream?startDate=20160118&endDate=20160128&aggregate=true HTTP/1.1 host: lss.bj.baidubce.com content-type: application/json authorization: bce-auth-v1/e8e4a9ced6794355a9a1b8a20b58d37b/2015-07-03T09:28:13Z/1800/content-type;host;x-bce-date/4a1692dc4bab84f5801f79ea0c1fece3601cf73ecd94409d2a94b3942b971715 ``` -------------------------------- ### Start React Demo Project Source: https://cloud.baidu.com/doc/AI_DH/s/bmg52lb7y Starts the React version of the demo project. This command compiles the project and launches a development server, typically serving the application at a local address. It assumes all dependencies have been installed. ```bash npm run start ``` -------------------------------- ### Compile and Run Demo Source: https://cloud.baidu.com/doc/EASYDL/s/Dl6c0uoue Instructions for compiling the SDK demo and running it with example commands. ```APIDOC ## Compile and Run Demo Model resource files are pre-packaged in the SDK. The demo project can be compiled and run directly. ### Compilation and Execution ```bash 1cd src 2mkdir build && cd build 3cmake .. 4make # make install is optional, or add the lib path to environment variables 6sudo make install 7sudo ldconfig 8./demo_batch_inference/easyedge_batch_inference {model RES folder} {test image path or folder path containing only images} {serial number} ``` ### Demo Run Example ```bash 1baidu@nano:~/ljay/easydl/sdk/demo/build$ ./demo_batch_inference/easyedge_batch_inference ../../../../RES/ /ljay/images/mix008.jpeg 22020-08-06 20:56:30,665 INFO [EasyEdge] 548125646864 Compiling model for fast inference, this may take a while (Acceleration) 32020-08-06 20:57:58,427 INFO [EasyEdge] 548125646864 Optimized model saved to: /home/baidu/.baidu/easyedge/jetson/mcache/24110044320/m_cache, Don't remove it 4Results of image /ljay/images/mix008.jpeg: 52, kiwi, p:0.997594 loc: 0.352087, 0.56119, 0.625748, 0.868399 62, kiwi, p:0.993221 loc: 0.45789, 0.0730294, 0.73641, 0.399429 72, kiwi, p:0.992884 loc: 0.156876, 0.0598725, 0.3802, 0.394706 81, tomato, p:0.992125 loc: 0.523592, 0.389156, 0.657738, 0.548069 91, tomato, p:0.991821 loc: 0.665461, 0.419503, 0.805282, 0.573558 101, tomato, p:0.989883 loc: 0.297427, 0.439999, 0.432197, 0.59325 111, tomato, p:0.981654 loc: 0.383444, 0.248203, 0.506606, 0.400926 121, tomato, p:0.971682 loc: 0.183775, 0.556587, 0.286996, 0.711361 131, tomato, p:0.968722 loc: 0.379391, 0.0386965, 0.51672, 0.209681 14Done ``` ### Test Demo HTTP Service After compiling the demo, an HTTP service is generated. Run the following command: ```bash 1# ./easyedge_serving {res_dir} {serial_key} {host, default 0.0.0.0} {port, default 24401} 2 ./easyedge_serving ../../../../RES "1111-1111-1111-1111" 0.0.0.0 24401 ``` The log will display: ```bash 1HTTP is now serving at 0.0.0.0:24401 ``` You can then open a browser to `http://{device_ip}:24401` to test by selecting images. You can also access the service via HTTP API calls (refer to the API description below). ### Integration Instructions This method involves embedding the runtime library into your application. #### Usage Flow Refer to the demo usage flow first. For errors, consult the file comments and log explanations. ```cpp 1// step 1: Configure model runtime parameters 2EdgePredictorConfig config; 3config.model_dir = model_dir; 4config.set_config(params::PREDICTOR_KEY_SERIAL_NUM, serial_num); 5config.set_config(params::PREDICTOR_KEY_GTURBO_MAX_BATCH_SIZE, 1); // Maximum batch size supported by the optimized model; actual inference images per batch cannot exceed this value 6config.set_config(params::PREDICTOR_KEY_GTURBO_FP16, false); // Set to true to enable faster fp16 mode inference; precision may slightly decrease. Depends on hardware support; not all models support fp16. Refer to documentation. 7config.set_config(params::PREDICTOR_KEY_GTURBO_COMPILE_LEVEL, 1); // Model compilation strategy. If max_batch_size differs from historical compilation, recompile the model. 8 9 10// step 2: Create and initialize Predictor 11auto predictor = global_controller()->CreateEdgePredictor(config); 12if (predictor->init() != EDGE_OK) { 13 exit(-1); 14} 15 16// step 3-1: Infer image 17auto img = cv::imread({image path}); 18std::vector results; 19predictor->infer(img, results); 20 21// step 3-2: Infer video 22std::vector results; 23FrameTensor frame_tensor; 24VideoConfig video_config; 25video_config.source_type = static_cast(video_type); // Source type definition reference: easyedge_video.h 26video_config.source_value = video_src; 27/* 28... more video_configs, configure as needed 29*/ 30auto video_decoding = CreateVideoDecoding(video_config); 31while (video_decoding->next(frame_tensor) == EDGE_OK) { 32 results.clear(); 33 if (frame_tensor.is_needed) { 34 predictor->infer(frame_tensor.frame, results); 35 render(frame_tensor.frame, results, predictor->model_info().kind); 36 } 37 //video_decoding->display(frame_tensor); // Display current frame, requires configuration in video_config 38 //video_decoding->save(frame_tensor); // Save current frame to video, requires configuration in video_config 39 } ``` ``` -------------------------------- ### GET /certificates/{certId} Source: https://cloud.baidu.com/doc/Reference/s/ejwvz29ci Retrieves detailed information about a specific certificate using its unique ID. This does not include the certificate's public or private key information. ```APIDOC ## GET /certificates/{certId} ### Description Retrieves detailed metadata for a specific certificate identified by its `certId`. This endpoint does not return the certificate's public or private key data. ### Method `GET` ### Endpoint `/certificates/{certId}` ### Parameters #### Path Parameters - **certId** (String) - Required - The unique identifier of the certificate to retrieve. ### Request Example ```java // Prepare parameter String certId = "Your-cert-id"; // Issue the request CertificateMeta certificateMeta = certClient.getCertInfo(certId); ``` ### Response #### Success Response (200) - **CertificateMeta** (Object) - An object containing the metadata of the specified certificate. **CertificateMeta Object Attributes:** - **certId** (String) - The unique identifier for the certificate. - **certName** (String) - The name of the certificate. - **certCommonName** (String) - The common name of the certificate (e.g., the domain name). - **certStartTime** (DateTime) - The date and time the certificate becomes effective. - **certStopTime** (DateTime) - The date and time the certificate expires. - **certCreateTime** (DateTime) - The date and time the certificate was created. - **certUpdateTime** (DateTime) - The date and time the certificate was last updated. #### Response Example ```json { "certId": "crt-xxxxxxxxxxxx", "certName": "MyDomain.com", "certCommonName": "*.example.com", "certStartTime": "2023-10-27T10:00:00Z", "certStopTime": "2024-10-27T10:00:00Z", "certCreateTime": "2023-10-27T09:00:00Z", "certUpdateTime": "2023-10-27T09:00:00Z" } ``` ```