How an SDK can save a beginner’s career.
[Initial experience in the workplace]
Time flies really fast, distance from the last arrangement to small Hi “face recognition” development task (talk to the next period: [quick play Huawei cloud development] small Hi patted you, based on huawei cloud API development you Get?) It has been more than a month, and no progress has been received. The boss is restless. Look, double 12 is only a week or two away, and here’s the deadline. Boss frowning, point a “meet 98” cigarette (small Hi just 98, everything is a coincidence), a long sigh of relief, to small Hi downstairs coffee shop to see the information.
For the second time since he joined the company, Hi is summoned by his boss alone, this time suddenly in the lofty “small sample” cafe (a cup of coffee can absorb the power of the universe). Small Hi feel not good, very nervous, after all, the boss confessed to the first task has not been done, encountered some difficulties.
After the boss greeted xiao Hi to take a seat, said with a smile (in the heart may be holding fire) : Hi, face recognition needs since a few days ago in Huawei cloud API Explorer found relevant API, progress is still smooth? Are there any difficulties that I need to push to solve?
Hi began to sweat… Stammering: “Boss, although we found the API we wanted, and all the debugging passed in API Explorer, but still not in the code project, I am a little frustrated… (Tears on the verge of falling).
Boss: Hi, don’t worry now. I understand how you feel and I have noticed that you have been working very hard recently. Let’s first get together, our goal is to double 12 before the official informant face recognition function, can you describe the current situation in detail?
Hi: Call these APIS in code need to do a lot of packaging work, such as here involves a lot of httpSclient public method packaging, involving ak/ SK access and generate token operations, need to write thousands of lines of code, I used to be unfamiliar with this, although in recent weeks to work overtime to catch up on the progress, but the progress is not very ideal, high risk oh;
Boss: Top manufacturers like Huawei cloud must provide SDK in addition to API. With the SDK, you only need to use the same functions, twice the result! In addition, there is any risk on the job later, we should give feedback in time and ask for help in time.
Small Hi confused (what is SDK? Don’t think the boss can blow water with customers, technical way is also quite wild. In some uncertainty, I remembered a famous saying “there is no retreat, is the road to victory”, so I raised my head and answered loudly: “Boss, after your guidance, I suddenly see the light, I will go to find the SDK, thank the boss, then I will go back to work, if there is a problem, I will timely help”. After saying this, he ran out of the cafe as if he had been invigorated. (He didn’t even have a sip of coffee, but he was inspired by the boss and absorbed the power of the universe.)
[The way to solve the difficulties]
I saw small Hi galloping from the aisle, like a BMW sweat blood, let colleagues are stunned, do not know which come of confidence. “I’m a little bird, and with the SDK, I can fly higher…” While humming a tune, enter SDK in the search box of huawei cloud official website. Then the operation is as fierce as a tiger:
- Open huawei cloud official website -> Developers ->SDK(developer.huaweicloud.com/sdk?all) :
- Search the FRS service for face recognition, find the Java SDK card, enter the SDK documentation first to see how to use:
- _SDK entry guidance in sight, _ can’t wait to start to operate: (support.huaweicloud.com/sdkreferenc…).
One by One, can not be simple, originally thought that “open face recognition service” operation takes half a day, did not expect to complete in 1 minute.
- The above environment preparation took about 10 minutes and was easily done. Small Hi confidence burst, the next look at the “interface example” code:
Construct the service client code:
String ak = "***"; String sk = "***"; String projectId = "**"; ProxyHostInfo ProxyHostInfo = new ProxyHostInfo(" Proxy ", 8080, "**", "**"); ProxyHostInfo = new ProxyHostInfo(" Proxy ", 8080, "**", "**"); // Service info String url = "https://face.cn-north-4.myhuaweicloud.com"; String region = "cn-north-4"; AuthInfo authInfo = new AuthInfo(url, region, ak, sk); FrsClient frsClient = new FrsClient(authInfo, projectId, proxyHostInfo); // When you need the proxy to access the service, add the proxy information in the third parameterCopy the code
Call face comparison function (check similarity)
CompareFaceResult = frsclient.getv2 ().getCompareService().compareFaceByFile("data small hi-front.png ", "Small data Hi - side. PNG");Copy the code
Face comparison picture:
__
Results: The fitting degree was about 97%
Small Hi see the results, or a little do not believe their eyes, happiness comes too suddenly? I used the API Explorer debugging function some time ago, so I want to compare the results of the two methods are consistent. … Click Debug and the result is exactly the same (the degree of similarity is about 97%) :
It’s amazing that you only need a copy of a few lines of code to complete the integration development of the face detection service API. Hi xiao ecstatic, originally with Huawei cloud API docking really with the legend of so simple, One by One is done, but I don’t know the shortcut. No Copy, More Code! Low Copy, Low Code, No Code!
【 Happiness Knocks 】
Write in the end: ginger or old hot, after the boss casually pull out, small Hi easy to use Huawei cloud SDK to complete the first task since entering the job, the so-called back against the tree good cool ah. One day later, small Hi happily walked into the boss’s office; Several minutes later, the sun is shining out of the office, the air is filled with the smell of promotion and salary. She proved the boss right lol…
According to a source, the boss is anxious to launch the facial recognition feature on Double 12 because his second son is due on December 12, and the boss wants to use his own product to do personal face recognition for the two sons to match their similarity. Oh, my God, how would it be if the proprietress knew?
River’s lake rumor, soon after the boss began to meet small Hi, confessed to secret errand. Like squatting wall root of the people, with similar intuition, intercepted the small Hi brainwave signal: “Huawei cloud CLI is what ghost? Oh, there’s a template engine. I’ve only heard of engine engines.” To be continued…
This article shares from Huawei cloud community “[Fast play Huawei cloud development] How to achieve the success of face recognition SDK debut, happiness!” ‘, by Jordan Jordan.
Click to follow, the first time to learn about Huawei cloud fresh technology ~