หน้านี้ยังไม่พร้อมใช้งานในภาษาท้องถิ่นของคุณ เรากำลังพยายามอย่างหนักเพื่อเพิ่มเวอร์ชันภาษาอื่น ๆ เพิ่มเติม ขอบคุณสำหรับการสนับสนุนเสมอมา

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
Help Center/ Face Recognition Service/ Getting Started/ Using an SDK for Face Detection

Using an SDK for Face Detection

Updated on 2024-09-30 GMT+08:00

FRS SDKs provide a range of RESTful APIs to simplify development.

This section provides an example of how to use the Java SDK to call the Face Detection API. You can directly call APIs to use SDK functions.

To call an FRS API in an SDK, there are four steps:

Step 1: Subscribe to the Subservice

Step 2: Configure the Environment

Step 3: Modify the Configuration

Step 4: Call the Service API

Preparations

You have registered an account with HUAWEI CLOUD. Your account is not in arrears or frozen.

Step 1: Subscribe to the Subservice

  1. Log in to the FRS console.
  2. Click Authorization in the navigation pane on the left. Click Agree on the displayed page to authorize FRS to access data stored on OBS.
  3. On the displayed Subscription page, select and subscribe to your desired APIs.

    In this example, subscribe to the Face Detection API.

Step 2: Configure the Environment

  1. Download the FRS Java SDK.

    In the huaweicloud-sdk-java-frs directory, choose Code > Download ZIP to download frs-sdk-demo.

  2. Prepare the Java development environment.
  3. Import the FRS Java SDK into a project.
    1. Copy the downloaded frs-sdk-demo file to the Eclipse project folder.
    2. Open the project in Eclipse, right-click the project, and choose Properties.
    3. In the displayed dialog box, click Java Build Path. In the Libraries tab, click Add JARs to add the JAR file in the frs-sdk-demo folder.

Step 3: Modify the Configuration

In this demo, the AK/SK is used for authentication.

  1. Obtain an AK/SK.

    The AK/SK is the access key. To obtain the AK/SK, log in to the My Credentials page, choose Access Keys in the left navigation pane, and click Create Access Key in the right pane.

  2. Use the AK/SK for authentication.

    Change the values of AK and SK of the Main function of frs-sdk-demo to the obtained AK/SK.

    Figure 1 Configuring the AK/SK
  3. Modify the frs-sdk-demo configuration file.
    Figure 2 frs-sdk-demo file
    Table 1 Parameters in the Main function

    Parameter

    Description

    Value

    ak

    Access key ID

    Log in to the My Credentials page and choose Access Keys > Add Access Key to obtain it.

    sk

    Secret access key)

    Log in to the My Credentials page and choose Access Keys > Add Access Key to obtain it.

    endpoint

    Endpoint

    Select the endpoint of the region where the service is enabled.

    region

    Region where the service locates

    Select the region where the service is enabled.

    projectId

    Project ID

    Project ID. For details about how to obtain the project ID, see Obtaining a Project ID.

    NOTE:
    • The demo contains example calls of all FRS APIs. If you need the Face Detection API only, comment out or delete other APIs in the Main.java file.
    • Change the image path in detectFaceByObsUrl to the OBS bucket path of the image.

Step 4: Send API Calling Requests

Execute the Main.java file. If status code 200 is displayed on the IDE console, the program is successfully executed.

The face detection result is returned in JSON format.

{
   "faces": [
     {
       "bounding_box": {
         "width": 174,
         "top_left_y": 37,
         "top_left_x": 22,
         "height": 174
       }
     }
   ] 
}

เราใช้คุกกี้เพื่อปรับปรุงไซต์และประสบการณ์การใช้ของคุณ การเรียกดูเว็บไซต์ของเราต่อแสดงว่าคุณยอมรับนโยบายคุกกี้ของเรา เรียนรู้เพิ่มเติม

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback