We use essential cookies for the website to function, as well as analytics cookies for analyzing and creating statistics of the website performance. To agree to the use of analytics cookies, click "Accept All". You can manage your preferences at any time by clicking "Cookie Settings" on the footer. More Information.
We use essential cookies for the website to function, as well as analytics cookies for analyzing and creating statistics of the website performance. To agree to the use of analytics cookies, click "Accept All". You can manage your preferences at any time by clicking "Cookie Settings" on the footer. More Information.
We use essential cookies for the website to function, as well as analytics cookies for analyzing and creating statistics of the website performance. To agree to the use of analytics cookies, click "Accept All". You can manage your preferences at any time by clicking "Cookie Settings" on the footer. More Information.
We use essential cookies for the website to function, as well as analytics cookies for analyzing and creating statistics of the website performance. To agree to the use of analytics cookies, click "Accept All". You can manage your preferences at any time by clicking "Cookie Settings" on the footer. More Information.
Scene detection quickly categorizes images by accurately defining the context of the scenes. Currently, this API recognizes diverse scene types, with a high degree of accuracy.
Scenarios
Smart shooting, image classification
This API provides precise identification of 103 scenarios, and can be applied in smart album features, image classification management, and auxiliary photography.
Photography aid
Scene detection determines the optimal photography settings, based on the specific shooting conditions.
Smart album management
Scene detection can also add smart classification tags to images, widely used in smart album generation and image categorization.
Description
Request
Copy
Bitmap bitmap = BitmapFactory.decodeFile(filePath); Frame frame = new Frame();// Construct FrameObject frame.setBitmap(bitmap); SceneDetector sceneDetector = new SceneDetector (context); // Construct Detector JSONObject jsonScene = detector.detect(frame, null); // Detect the scene Scene sc = sceneDetector.convertResult(jsonScene); // Get Java class Result int type = sc.getType(); // Recognize the type of scene
Response
Response
Copy
14(Refers to FIREWORK)
Start development here with Huawei
Service introduction
Service overview, application scenarios, and functions
1Can prepare() method directly use detect() method without calling the API?
Yes. In detect() method engine startup is in default. The engine will not start up again if started, please use with confidence.
2When should I call the release() method?
The release() method will uninstall a model that has been loaded to the NPU chip. If the app is no longer using face detection, uninstall the model in a timely manner to free up resources.
3Does HiAI support multi-thread calls?
The HiAi Engine does not allow an app to call multiple threads for a single API. This is because if one thread finishes first, it will call the release() method and uninstall the model, resulting in errors in all of the other threads. In the NPU, the back end service also executes tasks in order, so it is unable to run multiple threads through one function at the same time. However, multiple threads can be enabled at the same time if they are calling different APIs. For example, it is possible to enable one thread for Aesthetic Scoring, and another one for Scene Detection.