云端 AI 检测 & 视频消息

更新时间:2025-12-23 07:53:08下载pdf

涂鸦云通过先进的 AI 智能分析功能,实现目标对象的精准识别,包括但不限于小鸟、包裹等。此外,App 的消息中心提供以视频形式直观展示检测结果的功能,能够显著提升用户的使用体验。

开发指导

详见 ty_sdk_motion_detect.c

API 说明

初始化

/**
 * @brief        rule module init
 * @param[in]    result_cb callback of cloud result
 * @param[in]    video_msg_cb  callback of video ms
 * @return       error code
 * - OPRT_OK     success
 * - Others      failure
 */
OPERATE_RET tuya_ipc_rule_init(IN RULE_AI_RESULT_CB ai_result_cb, IN RULE_VIDEO_MSG_CB video_msg_cb);

参数说明

参数 说明
ai_result_cb 云端 AI 检测结果
video_msg_cb 视频消息结果

事件触发

事件触发后,设备向云端上传图片、视频等,用以检测目标。

/**
 * @brief        trigger event for rule module
 * @param[in]    event refer to NOTIFICATION_NAME_E
 * @param[out]   sn  event identification, used to distinguish different events
 * @return       error code
 * - OPRT_OK     success
 * - Others      failure
 */
OPERATE_RET tuya_ipc_rule_trigger_event(IN INT_T event, OUT UINT_T *sn);

参数说明

参数 说明
event 事件类型
sn 事件序号,用于区分不同的事件

停止推流

对于宠物类云端 AI,在移动侦测结束后,或者云端检测到没有宠物(即 ai_result_cb 的出参 result_list 不包含 ai_pet 字段),则结束推流。

/**
 * brief Stop streaming based on sn
 * @param[in]    sn  event identification. used to distinguish different events
 * @return       OPERATE_RET
 */
OPERATE_RET tuya_ipc_rule_stop_stream_by_sn(IN UINT_T sn);

参数说明

参数 说明
sn 事件序号,用于区分不同的事件

事件上报

上报智能事件

/**
 * @brief        report ai message
 * @param[in]    ai_result     ai result
 * @param[in]    is_notify  show in message center if TRUE
 * @return       error code
 * - OPRT_OK     success
 * - Others      failure
 */
OPERATE_RET tuya_ipc_rule_report_ai_msg(IN CHAR_T *ai_result, IN BOOL_T is_notify);

上报智能事件和视频消息

/**
 * @brief        report ai message and video message
 * @param[in]    ai_result  ai result
 * @param[in]    video_msg  video message
 * @param[in]    is_notify  show in message center if TRUE
 * @return       error code
 * - OPRT_OK     success
 * - Others      failure
 */
OPERATE_RET tuya_ipc_rule_report_ai_msg_with_video_msg(IN CHAR_T *ai_result, IN CHAR_T *video_msg, IN BOOL_T is_notify);

上报未检测到目标的智能事件

/**
 * @brief        report event if ai result is not detected
 * @param[in]    event      refer to NOTIFICATION_NAME_E
 * @param[in]    ai_result  ai result
 * @param[in]    is_notify  show in message center if TRUE
 */
OPERATE_RET tuya_ipc_rule_report_event(IN INT_T event, IN CHAR_T *ai_result, IN BOOL_T is_notify);

上报未检测到目标的智能事件和视频消息

/**
 * @brief        report event with video msg if ai result is not detected
 * @param[in]    event      refer to NOTIFICATION_NAME_E
 * @param[in]    ai_result  ai result
 * @param[in]    video_msg  video message
 * @param[in]    is_notify  show in message center if TRUE
 */
OPERATE_RET tuya_ipc_rule_report_event_with_video_msg(IN INT_T event, IN CHAR_T *ai_result, IN CHAR_T *video_msg, IN BOOL_T is_notify);

宠物类云端 AI 能力不需要调用事件上报接口,事件上报由云端处理。

低功耗喂鸟器产品开发

低功耗喂鸟器是一款集成 AI 视觉识别、松鼠驱逐于一体的智能喂鸟设备。通过先进的 AI 算法,能够自动识别鸟类,同时记录珍贵的观鸟瞬间。设备采用低功耗设计,支持长时间户外工作,为鸟类爱好者提供便捷的观鸟解决方案。

产品工作模式

App 展示

云端 AI 检测 & 视频消息 云端 AI 检测 & 视频消息

所有移动目标模式

  • 功能说明:用户将收到所有移动目标的消息(包括鸟、松鼠)。
  • 处理流程:在此模式下,移动侦测触发后需开启本地存储、云存储以及云端 AI 检测。如果检测到目标,则调用事件检测接口上报事件(接口定义详见 事件上报 章节)。若未检测到目标,则调用 tuya_ipc_notify_alarm 上报事件。

智能模式

  • 功能说明:用户将只会收到鸟和松鼠的侦测消息动目标的消息。
  • 处理流程:在此模式下,移动侦测触发后需开启云端 AI 检测。如果检测到目标,需开启本地存储、云存储,调用事件检测接口上报事件(接口定义详见事件上报章节)。若未检测到目标,则进入休眠。

关闭侦测模式

  • 功能说明:无移动目标推送消息。
  • 处理流程:不触发移动侦测即可。

业务流程

超时
开始
移动侦测触发
唤醒后需保存首图用于 AI 检测
SDK 通过 TUYA_APP_get_snapshot_cb 获取图片
调用 tuya_ipc_rule_trigger_event
触发 AI 检测
所有移动目标模式?
调用 tuya_ipc_start_storage
开启本地存储和云存储
8 秒内 TUYA_APP_ai_result_cb
是否获取到检测结果?
结果是否包含智能对象 ai_bird?
所有移动目标模式?
智能模式?
智能模式?
调用 tuya_ipc_start_storage
开启本地存储和云存储
调用事件上报接口推送智能对象消息, 接口详见事件上报章节
是否 开启松鼠驱逐开关 且 智能对象包含 ai_squirrel?
调用 tuya_ipc_rule_report_expel_squirrel
推送松鼠驱逐消息
打开 siren 报警, 15s 后关闭
录像完成后休眠
休眠
调用事件上报接口推送智能对象消息, 详见事件上报章节
录像完成后休眠
调用 tuya_ipc_notify_alarm
上报移动侦测消息和图片
录像完成后休眠
休眠
结束