<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Claire_shuo</title>
    <description>The latest articles on DEV Community by Claire_shuo (@pasonghun0000).</description>
    <link>https://dev.to/pasonghun0000</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3298621%2F427fb81c-7406-4b2c-8fc5-15304e613982.png</url>
      <title>DEV Community: Claire_shuo</title>
      <link>https://dev.to/pasonghun0000</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/pasonghun0000"/>
    <language>en</language>
    <item>
      <title>DevEco Studio in Practice: The Intelligent Engine Developed by HarmonyOS</title>
      <dc:creator>Claire_shuo</dc:creator>
      <pubDate>Fri, 27 Jun 2025 01:59:37 +0000</pubDate>
      <link>https://dev.to/pasonghun0000/deveco-studio-in-practice-the-intelligent-engine-developed-by-harmonyos-3h0i</link>
      <guid>https://dev.to/pasonghun0000/deveco-studio-in-practice-the-intelligent-engine-developed-by-harmonyos-3h0i</guid>
      <description>&lt;p&gt;As a HarmonyOS developer, DevEco Studio is the core productivity tool for daily development. Through multiple project practices, these key experiences for improving development efficiency have been summarized:&lt;/p&gt;

&lt;p&gt;Three core advantage experiences&lt;/p&gt;

&lt;p&gt;Core code example (Real-time preview + Hot reload) :&lt;/p&gt;

&lt;p&gt;// Use the @Preview annotation to achieve real-time preview of multiple devices&lt;br&gt;
@Preview({&lt;br&gt;
DeviceType: [devicetype.phone, devicetype.watch, devicetype.tv], // Three-terminal synchronization&lt;br&gt;
width: '100%',&lt;br&gt;
height: '100%'&lt;br&gt;
})&lt;br&gt;
@Component&lt;br&gt;
struct WeatherCard {&lt;br&gt;
@State temp: number = 26&lt;br&gt;
@State city: string = "Beijing"&lt;/p&gt;

&lt;p&gt;build() {&lt;br&gt;
Column() {&lt;br&gt;
// Temperature display (Real-time modified values can be previewed immediately)&lt;br&gt;
Text(&lt;code&gt;${this.temp}℃&lt;/code&gt;).fontSize(24).fontColor(this.temp &amp;gt; 30 ?  Color.Red : Color.Blue)&lt;/p&gt;

&lt;p&gt;// City selector&lt;br&gt;
Select([&lt;br&gt;
{value: "Beijing"},&lt;br&gt;
{value: "Shanghai"},&lt;br&gt;
{value: "Guangzhou"}&lt;br&gt;
])&lt;br&gt;
.selected(0)&lt;br&gt;
.onSelect((index) =&amp;gt; {&lt;br&gt;
this.city = [" Beijing "," Shanghai "," Guangzhou "][index]&lt;br&gt;
this.fetchWeather() // retains the status of hot reload&lt;br&gt;
})&lt;br&gt;
.margin(10)&lt;/p&gt;

&lt;p&gt;// Dynamic weather icon&lt;br&gt;
Image(this.getWeatherIcon())&lt;br&gt;
.width(50)&lt;br&gt;
.height(50)&lt;br&gt;
}&lt;br&gt;
.padding(20)&lt;br&gt;
.borderRadius(12)&lt;br&gt;
.backgroundColor(Color.White)&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;When modifying this method, hot reload takes effect immediately&lt;/p&gt;

&lt;p&gt;private getWeatherIcon(): Resource {&lt;br&gt;
return this.temp &amp;gt; 30 ?  $r("app.media.sun") :&lt;br&gt;
this.temp &amp;lt; 10 ?  $r("app.media.snow") : $r("app.media.cloud")&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;// Simulation data acquisition&lt;br&gt;
private fetchWeather() {&lt;br&gt;
When modifying API parameters, hot reload does not reset the state&lt;br&gt;
mockRequest(&lt;code&gt;/weather? city=${this.city}&lt;/code&gt;).then(data =&amp;gt; {&lt;br&gt;
this.temp = data.temp&lt;br&gt;
})&lt;br&gt;
}&lt;br&gt;
}&lt;br&gt;
Efficient development skills:&lt;/p&gt;

&lt;p&gt;Terminal input viewing rendering takes a long time&lt;/p&gt;

&lt;p&gt;hdc shell hilog -s 0xD001411 -a Performance&lt;br&gt;
Measured data: After using DevEco Studio, the UI development efficiency has increased by more than 50%, and the debugging time has decreased by 70%. Its intelligent prompt and real-time preview capabilities have completely transformed the HarmonyOS development experience, allowing developers to focus on creating value rather than configuring the environment.&lt;/p&gt;

&lt;p&gt;DevEco Studio is not only a development tool, but also the intelligent hub of the HarmonyOS ecosystem. Proficient in its visual debugging and performance optimization capabilities, achieving twice the result with half the effort in the development of full-scenario applications, and efficiently building future-oriented HarmonyOS applications.&lt;/p&gt;

&lt;p&gt;​&lt;/p&gt;

</description>
    </item>
    <item>
      <title>HarmonyOS Router Parameter Passing in Practice: The Art of Cross-Page Data Transmission</title>
      <dc:creator>Claire_shuo</dc:creator>
      <pubDate>Fri, 27 Jun 2025 01:57:44 +0000</pubDate>
      <link>https://dev.to/pasonghun0000/harmonyos-router-parameter-passing-in-practice-the-art-of-cross-page-data-transmission-1pip</link>
      <guid>https://dev.to/pasonghun0000/harmonyos-router-parameter-passing-in-practice-the-art-of-cross-page-data-transmission-1pip</guid>
      <description>&lt;p&gt;In the development of HarmonyOS applications, route parameter passing is a core technology for communication between pages. A well-designed parameter passing mechanism for routes is crucial for complex applications. During the learning process of HarmonyOS, there are multiple routing methods available. Here are some experiences shared regarding route parameter passing:&lt;/p&gt;

&lt;p&gt;I. Router&lt;/p&gt;

&lt;p&gt;Core Skills:&lt;/p&gt;

&lt;p&gt;Core code example (user detail page jump):&lt;/p&gt;

&lt;p&gt;// User List Page (Passing Parameters) import router from '@ohos.router';&lt;/p&gt;

&lt;p&gt;@Entry&lt;br&gt;
@Component&lt;br&gt;
struct UserListPage {&lt;br&gt;
const privateUser = { id: 1001, name: '张三', vip: true &lt;/p&gt;

&lt;p&gt;build() {&lt;br&gt;
List() {&lt;br&gt;
ListItem() {&lt;br&gt;
Text(this.user.name)&lt;br&gt;
.onClick(() =&amp;gt; {&lt;br&gt;
// Jump and pass complex objects router.pushUrl({&lt;br&gt;
url: 'pages/UserDetailPage',&lt;br&gt;
params: {&lt;br&gt;
userData: JSON.stringify(this.user),  // Serialize the object source: 'homePage'&lt;br&gt;
}&lt;br&gt;
})&lt;br&gt;
})&lt;br&gt;
}&lt;br&gt;
}&lt;br&gt;
}&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;// User Details Page (Receiving Parameters) @Component&lt;br&gt;
export struct UserDetailPage {&lt;br&gt;
@State userId: number = 0;&lt;br&gt;
@State userName: string = '';&lt;br&gt;
@State isVip: boolean = false;&lt;/p&gt;

&lt;p&gt;onPageShow() {&lt;br&gt;
const params = router.getParams();  // Get route parameters try {&lt;br&gt;
if (params) {&lt;br&gt;
const user = JSON.parse(params['userData'] as string);  // Deserialization this.userId = user.id;&lt;br&gt;
this.userName = user.name;&lt;br&gt;
this.isVip = user.vip;&lt;br&gt;
console.log(&lt;code&gt;Source page: ${params.source}&lt;/code&gt;); }&lt;br&gt;
} catch (error) {&lt;br&gt;
console.error('Parameter parsing error', error); }&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;build() {&lt;br&gt;
Column() {&lt;br&gt;
Text(&lt;code&gt;ID: ${this.userId}&lt;/code&gt;).fontSize(18)&lt;br&gt;
Text(&lt;code&gt;Name: ${this.userName}&lt;/code&gt;).fontColor(this.isVip ? 'red' : 'black') Color.Red : Color.Black)&lt;br&gt;
// ... }&lt;br&gt;
}&lt;br&gt;
}&lt;br&gt;
Guide to Avoiding Pitfalls:&lt;/p&gt;

&lt;p&gt;router.back({&lt;br&gt;
url: 'pages/UserListPage',&lt;br&gt;
params: { updated: true }&lt;br&gt;
})&lt;br&gt;
II. HMRouter&lt;/p&gt;

&lt;p&gt;HMRouter is a scene solution for page navigation on HarmonyOS, mainly addressing the issue of mutual navigation between native pages within an application. This article mainly takes various scenarios in actual development as examples to introduce the usage of the HMRouter routing framework. The HMRouter routing framework provides the following functional features:&lt;/p&gt;

&lt;p&gt;HMRouter provides page navigation and back functionality based on custom annotations. The usage steps are as follows:&lt;/p&gt;

&lt;p&gt;Page redirection&lt;/p&gt;

&lt;p&gt;Configure page routes&lt;br&gt;
@HMRouter({ pageUrl: 'profile/Address' })&lt;br&gt;
@Entry&lt;br&gt;
@Component&lt;br&gt;
export struct Address {&lt;br&gt;
...&lt;br&gt;
}&lt;br&gt;
Page Jumping&lt;br&gt;
onClick(()=&amp;gt;{&lt;br&gt;
...&lt;br&gt;
HMRouterMgr.push({pageUrl:'profile/Address',animator:true})&lt;br&gt;
})&lt;br&gt;
Page parameter passing&lt;br&gt;
Passing parameters&lt;/p&gt;

&lt;p&gt;.onClick(() =&amp;gt; {&lt;br&gt;
HMRouterMgr.push({pageUrl:'goods/Detail',param:item})&lt;/p&gt;

&lt;p&gt;// -----&lt;br&gt;
})&lt;br&gt;
Receive parameters&lt;/p&gt;

&lt;p&gt;@HMRouter({pageUrl:'goods/Detail'})&lt;br&gt;
@ComponentV2&lt;br&gt;
export struct GoodsDetail {&lt;br&gt;
&lt;a class="mentioned-user" href="https://dev.to/local"&gt;@local&lt;/a&gt; item:HMPageParam=HMRouterMgr.getCurrentParam(HMParamType.all) as HMPageParam&lt;br&gt;
&lt;a class="mentioned-user" href="https://dev.to/provider"&gt;@provider&lt;/a&gt;() goods:GoodsItemType=this.item.data as GoodsItemType&lt;br&gt;
...&lt;br&gt;
}&lt;br&gt;
Suggested application scenarios:&lt;/p&gt;

&lt;p&gt;Simple application: Directly use HMRouter's annotations + interceptors to quickly achieve decoupled navigation.&lt;/p&gt;

&lt;p&gt;Large-scale projects: By adopting TheRouter, the modular collaboration issues are resolved through dynamic routing tables and service injection (ServiceProvider) 84.&lt;/p&gt;

&lt;p&gt;By making reasonable use of HMRouter, over 30% of the routing glue code can be reduced, making it particularly suitable for cross-team collaboration in HarmonyOS application projects.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>HarmonyOS Pull-down Menu Project Practice: Flexible Application of the Select Component</title>
      <dc:creator>Claire_shuo</dc:creator>
      <pubDate>Fri, 27 Jun 2025 01:54:06 +0000</pubDate>
      <link>https://dev.to/pasonghun0000/harmonyos-pull-down-menu-project-practice-flexible-application-of-the-select-component-4pep</link>
      <guid>https://dev.to/pasonghun0000/harmonyos-pull-down-menu-project-practice-flexible-application-of-the-select-component-4pep</guid>
      <description>&lt;p&gt;In the development of HarmonyOS applications, the Select dropdown menu is a frequently used interactive control. It can efficiently display multiple options within a limited space, providing a dropdown selection menu that enables users to choose among multiple options.&lt;/p&gt;

&lt;p&gt;Core implementation techniques:&lt;/p&gt;

&lt;p&gt;Core code example:&lt;/p&gt;

&lt;p&gt;// xxx.ets&lt;br&gt;
@Entry&lt;br&gt;
@Component&lt;br&gt;
struct SelectExample {&lt;br&gt;
@State text: string = "TTTTT";&lt;br&gt;
@State index: number = 2;&lt;br&gt;
@State space: number = 8;&lt;br&gt;
@State arrowPosition: ArrowPosition = ArrowPosition.END;&lt;/p&gt;

&lt;p&gt;build() {&lt;br&gt;
Column() {&lt;br&gt;
Select([{ value: 'aaa', icon: $r("app.media.selection") },&lt;br&gt;
{ value: 'bbb', icon: $r("app.media.selection") },&lt;br&gt;
{ value: 'ccc', icon: $r("app.media.selection") },&lt;br&gt;
{ value: 'ddd', icon: $r("app.media.selection") }])&lt;br&gt;
.selected(this.index)&lt;br&gt;
.value(this.text)&lt;br&gt;
.font({ size: 16, weight: 500 })&lt;br&gt;
.fontColor('#182431')&lt;br&gt;
.selectedOptionFont({ size: 16, weight: 400 })&lt;br&gt;
.optionFont({ size: 16, weight: 400 })&lt;br&gt;
.space(this.space)&lt;br&gt;
.arrowPosition(this.arrowPosition)&lt;br&gt;
.menuAlign(MenuAlignType.START, { dx: 0, dy: 0 })&lt;br&gt;
.optionWidth(200)&lt;br&gt;
.optionHeight(300)&lt;br&gt;
.onSelect((index: number, text? : string | undefined) =&amp;gt; {&lt;br&gt;
console.info('Select:' + index);&lt;br&gt;
this.index = index;&lt;br&gt;
if (text) {&lt;br&gt;
this.text = text;&lt;br&gt;
}&lt;br&gt;
})&lt;br&gt;
.avoidance(AvoidanceMode.COVER_TARGET);&lt;br&gt;
}.width('100%')&lt;br&gt;
}&lt;br&gt;
}&lt;br&gt;
Guide to Avoiding Pitfalls:&lt;/p&gt;

&lt;p&gt;It is worth noting that when using the select dropdown menu, the select passes an array of objects. When the number of required items in the dropdown menu increases, you can directly import the array of objects and render the page data through the map method.&lt;/p&gt;

&lt;p&gt;Core code example: (Product Filter)&lt;/p&gt;

&lt;p&gt;// Define option types interface Option {&lt;br&gt;
name: string,&lt;br&gt;
icon: Resource&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;@Entry&lt;br&gt;
@Component&lt;br&gt;
struct ProductPage {&lt;br&gt;
@State selectedIndex: number = 0&lt;br&gt;
@State options: Option[] = [&lt;br&gt;
{&lt;br&gt;
  name: 'Latest Products',&lt;br&gt;
  icon: $r('app.media.new')&lt;br&gt;
},&lt;br&gt;
{&lt;br&gt;
  name: 'Price: Low to High',&lt;br&gt;
  icon: $r('app.media.price_up')&lt;br&gt;
},&lt;br&gt;
{&lt;br&gt;
  name: 'Best Sellers',&lt;br&gt;
  icon: $r('app.media.hot')&lt;br&gt;
} ]&lt;/p&gt;

&lt;p&gt;build() {&lt;br&gt;
Column() {&lt;br&gt;
// Implementation of the Select component Select(this.options.map(opt =&amp;gt; ({&lt;br&gt;
value: opt.name,&lt;br&gt;
icon: opt.icon  // Icon and text combination })))&lt;br&gt;
.selected(this.selectedIndex)&lt;br&gt;
.onSelect((index: number) =&amp;gt; {&lt;br&gt;
this.selectedIndex = index&lt;br&gt;
this.filterProducts() // Trigger the filtering logic })&lt;br&gt;
.selectedOptionFont({ size: 18, weight: FontWeight.Bold })&lt;br&gt;
.optionFont({ size: 16 })&lt;br&gt;
.width('60%')&lt;/p&gt;

&lt;p&gt;// Product list display... }&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;// Filtering logic filterProducts() {&lt;br&gt;
switch(this.selectedIndex) {&lt;br&gt;
case 0: // Logic for latest products&lt;br&gt;
case 1: // Logic for price sorting&lt;br&gt;
case 2: // Logic for sales volume sorting }&lt;br&gt;
}&lt;br&gt;
}&lt;br&gt;
The Select component perfectly aligns with the declarative UI paradigm of HarmonyOS, achieving automatic UI updates through data binding. Coupled with icon integration and style customization capabilities, developers can quickly build both aesthetically pleasing and powerful filtering controls. In scenarios such as e-commerce and settings pages, the judicious use of Select can significantly enhance user operation efficiency, making it an essential skill for HarmonyOS application development.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>HarmonyOS Application Development in Practice: HarmonyOS SDK AI Empowering Image Classification</title>
      <dc:creator>Claire_shuo</dc:creator>
      <pubDate>Fri, 27 Jun 2025 01:50:39 +0000</pubDate>
      <link>https://dev.to/pasonghun0000/harmonyos-application-development-in-practice-harmonyos-sdk-ai-empowering-image-classification-1hec</link>
      <guid>https://dev.to/pasonghun0000/harmonyos-application-development-in-practice-harmonyos-sdk-ai-empowering-image-classification-1hec</guid>
      <description>&lt;p&gt;In the development of HarmonyOS applications, the powerful edge-side AI capabilities of the HarmonyOS SDK have opened the door to intelligent applications for developers. Its core advantages lie in the efficient model reasoning, privacy and security (local data processing), and smooth integration. The following takes the most typical image classification task as an example to share practical experience and core code integration.&lt;br&gt;
Core process and code implementation:&lt;br&gt;
The entire process revolves around the capabilities under the @ohos.ai namespace. First, declare the necessary ohos.permission.READ_MEDIA permission in module.json5. The core code focuses on model loading, input preparation, inference execution and result parsing:&lt;/p&gt;

&lt;p&gt;import { image } from '&lt;a class="mentioned-user" href="https://dev.to/kit"&gt;@kit&lt;/a&gt;.ImageKit';&lt;br&gt;
import { modelManager, tensor, Model, ModelDescription, common } from '&lt;a class="mentioned-user" href="https://dev.to/kit"&gt;@kit&lt;/a&gt;.AiKit';&lt;/p&gt;

&lt;p&gt;// 1. Initialize &amp;amp; load the model&lt;br&gt;
let model: Model | null = null;&lt;br&gt;
const modelDesc: ModelDescription = {&lt;br&gt;
modelPath: 'pages/model/mobilenetv3_small_hiai.pt', // HAP built-in model path&lt;br&gt;
deviceType: common.DeviceType.AUTO, // Automatically select the best device (CPU/GPU/NPU)&lt;br&gt;
inferenceMode: common.InferenceMode.HIGH_SPEED,&lt;br&gt;
};&lt;br&gt;
modelManager.loadModel(modelDesc)&lt;br&gt;
.then((loadedModel: Model) =&amp;gt; {&lt;br&gt;
model = loadedModel;&lt;br&gt;
console.info('Model loaded successfully.');&lt;br&gt;
})&lt;br&gt;
.catch((err: Error) =&amp;gt; {&lt;br&gt;
console.error(&lt;code&gt;Model load failed: ${err.message}&lt;/code&gt;);&lt;br&gt;
});&lt;/p&gt;

&lt;p&gt;// 2. Prepare to input the Tensor (assuming the PixelMap object 'pixelMap' has been obtained)&lt;/p&gt;

&lt;p&gt;const inputTensor: tensor.Tensor = tensor.createTensorFromPixelMap(pixelMap,&lt;br&gt;
{ dataType: tensor.DataType.UINT8, shape: [1, 3, 224, 224] });  // NHWC -&amp;gt; NCHW conversion&lt;/p&gt;

&lt;p&gt;// 3. Perform model reasoning&lt;br&gt;
if (model) {&lt;br&gt;
model.run([inputTensor])&lt;br&gt;
.then((outputTensors: tensor.Tensor[]) =&amp;gt; {&lt;br&gt;
// 4. Parse the output (assuming the output is a Float32 probability array of [1, 1000])&lt;br&gt;
const outputData = new Float32Array(outputTensors[0].data);&lt;br&gt;
const topK = findTopKIndices(outputData, 3);  // A custom function is used to obtain the Top K index&lt;br&gt;
console.info(&lt;code&gt;Top Predictions: ${topK.map(idx =&amp;gt; CLASS_LABELS[idx]).join(', ')}&lt;/code&gt;);&lt;br&gt;
})&lt;br&gt;
.catch((runErr: Error) =&amp;gt; {&lt;br&gt;
console.error(&lt;code&gt;Inference failed: ${runErr.message}&lt;/code&gt;);&lt;br&gt;
});&lt;br&gt;
}&lt;br&gt;
Key experience:&lt;/p&gt;

&lt;p&gt;Model deployment: Prioritize the direct packaging of lightweight models (such as.pt,.onnx) into HAP, eliminating the reliance on dynamic downloads.&lt;br&gt;
Input preprocessing: createTensorFromPixelMap automatically handles image scaling and format conversion, significantly simplifying the process. Be sure to match the shape required by the model (such as [1, 3, 224, 224]).&lt;br&gt;
Device selection: DeviceType.AUTO enables the system to intelligently schedule NPU/GPU resources, significantly enhancing inference speed.&lt;br&gt;
Result parsing: The shape and dataType of the output Tensor must strictly correspond to the model definition. Float32Array parsing is suitable for the output of classification confidence.&lt;br&gt;
Beyond basic image classification, there is still much room for in-depth optimization and scene expansion in HarmonyOS AI development.&lt;br&gt;
Model optimization techniques&lt;br&gt;
Quantization and compression: Use the Huawei MindSpore Lite toolchain to convert the FP32 model into INT8 format, reducing the volume by 75% and doubling the inference speed.&lt;br&gt;
// Load the quantitative model&lt;br&gt;
const quantModelDesc: ModelDescription = {&lt;br&gt;
modelPath: 'pages/model/mobilenetv3_quant.ms',&lt;br&gt;
deviceType: common.DeviceType.NPU, // specifies NPU acceleration&lt;br&gt;
ComputeUnit: common.Com puteUnit FLOAT16 / / mixed computing precision&lt;br&gt;
};&lt;br&gt;
Multi-model cascading: Connecting object detection and classification models to achieve complex scene understanding.&lt;br&gt;
// Perform object detection first&lt;br&gt;
const detectOutput = await detectionModel.run([inputTensor]);&lt;br&gt;
const cropTensor = processDetection(detectOutput);  // Extract the ROI area&lt;/p&gt;

&lt;p&gt;// Then perform fine-grained classification&lt;br&gt;
const classifyOutput = await classificationModel.run([cropTensor]);&lt;br&gt;
Scene expansion practice&lt;br&gt;
Dynamic image enhancement: Combining AI and graphics capabilities to&lt;/p&gt;

&lt;p&gt;import { effectKit } from '&lt;a class="mentioned-user" href="https://dev.to/kit"&gt;@kit&lt;/a&gt;.ArkGraphics2D';&lt;/p&gt;

&lt;p&gt;// Low-light enhancement model reasoning&lt;br&gt;
const enhancedTensor = await lowlightModel.run([inputTensor]);&lt;/p&gt;

&lt;p&gt;// Go back to PixelMap and render&lt;br&gt;
const enhancedPixelMap = tensor.createPixelMapFromTensor(enhancedTensor);&lt;br&gt;
effectKit.createImageEffect(enhancedPixelMap)&lt;br&gt;
.addEffect('FILTER_SHARPEN')&lt;br&gt;
.render(canvas);&lt;br&gt;
Performance monitoring scheme&lt;/p&gt;

&lt;p&gt;// Obtain the inference performance data&lt;br&gt;
const perfInfo = model.getModelInferencePerformance();&lt;br&gt;
console.log(' Inference time consumption: ${perfInfo.inferenceTime}ms | Peak memory: ${perfInfo.memoryPeak}MB ');&lt;/p&gt;

&lt;p&gt;// Temperature protection strategy&lt;br&gt;
deviceManager.on('thermal', (level) =&amp;gt; {&lt;br&gt;
if (level &amp;gt; 2) model.setInferenceMode(common.InferenceMode.LOW_POWER);&lt;br&gt;
});&lt;br&gt;
New Trends in Ecology&lt;br&gt;
1.ArkTS 3.0: A new AI visual debugger has been added to view feature maps in real time&lt;br&gt;
2.DevEco 5.0: The model quantization and compression tool is built-in and supports direct conversion to ONNX&lt;/p&gt;

&lt;p&gt;Pre-set model library: Huawei ModelHub has provided over 100 HarmonyOS optimized models (OCR/ voice /NLP).&lt;br&gt;
Summary of Best Practices&lt;br&gt;
Device-aware adaptation: NPU availability is detected through common.DeviceCapability, and model accuracy is dynamically switched&lt;br&gt;
Memory lifecycle: Timely call model.release() and tensor.release() to prevent memory leaks&lt;br&gt;
Privacy compliance: Sensitive data is physically erased using tensor.secureDestroy()&lt;br&gt;
Model hot Update: Combine @ohos.fileio to achieve dynamic update of the safe zone model&lt;br&gt;
With the advancement of HarmonyOS NEXT, the edge-cloud collaborative AI framework (edge-side preprocessing + cloud-side large model) will become a new trend. It is suggested that developers pay attention to the distributedAI interface @ohos.distributedAI and lay out the multi-device collaborative inference scenario in advance.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
