In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article is about Unity Baidu AI how to achieve Logo trademark recognition, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article. Let's take a look at it with the editor.
API description:
The request is used to detect and identify brand LOGO information in the picture. That is, for an input picture (which can be decoded normally and the aspect ratio is appropriate), the name, location and confidence of the LOGO in the output picture are output. When the effect is not good, you can set up a sub-library (create an application in the Baidu developer Center console and apply to build a database) and complete the custom logo storage by calling the logo entry API to improve the recognition effect.
Create an application:
Search for image recognition in product services, create applications, and obtain AppID, APIKey, SecretKey information:
Check the official documents. The following is the details of the data parameters returned by the Logo trademark identification API:
Define the data structure:
Using System;/// Logo identifies the response data structure / [Serializable] public class LogoRecognition {/ request identification code, random number, unique / / public float log_id; / returns the number of results, that is, the number of elements in the result array / public int result_num / returns an array of results, each of which is an identified logo / / public LogoRecognitionResult [] result;} [Serializable] public class LogoRecognitionResult {/ location information / public LogoRecognitionResultLocation location; / recognized brand name / public string name / confidence of classification results (0mur1.0) / public float probability; / type=0 is the result of 1, 000 high-quality trademark recognition; type=1 is the result of 20, 000 class logo libraries Other type is custom logo library result / public int type;} / location information / [Serializable] public class LogoRecognitionResultLocation {/ left pixel position / public float left; / pixel location / public float top / Pixel width / public float width; / Pixel height / public float height;}
Download C# SDK:
Import the AipSdk.dll dynamic library into Unity when the download is complete:
The following are the details of the parameters passed when the API is called:
Encapsulate the calling function:
Using System;using UnityEngine;using Newtonsoft.Json;using System.Collections.Generic; / Image recognition / public class ImageRecognition {/ / the following information is available on the Baidu developer Center console to create an application and get private const string appID = ""; private const string apiKey = ""; private const string secretKey = "" / Logo trademark recognition / Logo picture byte data / whether to use only the result of custom logo library. Default false: return the recognition result of custom library + default library / public static LogoRecognition Logo (byte [] bytes, bool customLib = false) {var client = new Baidu.Aip.ImageClassify.ImageClassify (apiKey, secretKey) Try {var options = new Dictionary {{"custom_lib", customLib}}; var response = client.LogoSearch (bytes, options); LogoRecognition logoRecognition = JsonConvert.DeserializeObject (response.ToString ()); return logoRecognition } catch (Exception error) {Debug.LogError (error);} return null;}}
Test picture:
Using System.IO;using UnityEngine; public class Example: MonoBehaviour {private void Start () {ImageRecognition.Logo (File.ReadAllBytes (Application.dataPath + "/ Picture.jpg");}}
The above is Unity Baidu AI how to achieve Logo trademark recognition, the editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.