应用场景:
新零售场景(便利店) 1. 简介
使用场景
新零售场景物体多模态感知记忆推理模型主要可以应用于新零售场景,可供便利店与无人超市应用开发者、科研人员、教育工作者使用。
目标用户
便利店 & 无人超市应用开发者:新零售场景物体多模态感知记忆推理模型(便利店)目前包含221种类别,可应用于便利店商品检测、商品分类、智能下单等场景,也可以快速构建个人商品库进行分类检测,缩短开发周期。
科研用户:支持科研人员在机器人视觉领域进行算法优化、场景感知、大模型测试等前沿探索,推动智能化应用研究。
教育用户:用于机器人感知视觉检测实验教学,让学生实践理论知识,设计并完成相关实验项目。
2. 快速入门
基础环境准备
配套版本要求
项目 | 版本 |
---|---|
操作系统 | ubuntu20.04 |
架构 | x86 |
显卡驱动 | nvidia-driver-535 |
Python | 3.8 |
pip | 24.9.1 |
安装conda和python环境
安装conda包管理工具和python对应环境,详细请参考安装conda和python环境。
构建python环境
创建conda虚拟环境。
bashconda create -n faiss python=3.10 -y
激活虚拟环境。
bashconda activate faiss
查看python版本。
bashpython -V
查看pip版本。
bashpip -V
更新pip到最新版本。
bashpip install -U pip
安装python环境三方包依赖
安装基础环境+faiss。
bashconda install -n faiss pytorch==2.1.0 torchvision==0.16.0 torchaudio==2.1.0 pytorch- cuda=12.1 -c pytorch -c nvidia conda install -n faiss faiss-gpu -c pytorch
安装依赖库。
bashpython -m pip install -U huggingface_hub keyboard psutil datasets pillow IPython transformers==4.38.2
安装yolo依赖。
bashcd ../ObjectLocator_Classifer python -m pip install -r requirements.txt
获取代码
请访问代码下载获取模型代码。
获取模型(zip包中提供)
请访问模型下载获取模型文件,以下为对应模型文件说明。
序号 | 文件名 | 说明 |
---|---|---|
1 | shelve_platform_augment_truncation_1206.pt | 用于接收视频流数据,模型能基于rgb图像与深度图像得到检测框。 |
2 | dino_vectors_huojia_0401 | 用于对检测框图像进行特征提取,得到的特征向量用于下一步向量相似度搜索。 |
3 | dinov2_model | 向量对比库,通过将输入的特征向量与此向量库的对比得到检测物体具体类别。 |
4 | CDNet.pth | 对rgb图像进行深度恢复,得到rgb图像对应的深度图像。 |
运行代码
python
# 设置路径
rgbd_model_path = "设置为yolo-rgbd目录的本地路径"
rgbd_init_weight_path = "设置为CDNet.pth目录的本地路径"
clip_model_path = "设置为dinov2_model目录的本地路径"
faiss_path = "设置为dino_vectors_huojia_0401目录的本地路径"
#初始化参数
camera_width=1280
camera_height=720
target_imgWidth = 640
target_imgHeight = 360
conf=0.55
# 实例化对象
solver = Solver()
rgbd_dinov2_inference = memory_Inference()
# 初始化模型
rgbd_model, solver, clip_model, clip_processor, category_name_faiss, index_faiss=rgbd_dinov2_inference.gen_model(rgbd_model_path, solver, rgbd_init_weight_path,clip_model_path,faiss_path)
# 实例化相机类
camera = realsense.RealSenseCamera()
camera.set_resolution(1280,720)
# 启动相机流并获取内参信息
camera.start_camera()
while True:
#相机读取RGB+D流
color_frame, _, _, point_cloud, _ = camera.read_align_frame()
3. API调用
模型调用启动
python
# 进行深度学重建
resize_color_frame = cv2.resize(color_frame, (target_imgWidth, target_imgHeight))
depth_img_restore = cv2.cvtColor(solver.test(img=resize_color_frame), cv2.COLOR_GRAY2RGB)
if len(color_frame):
# 进行RGBD 定位
rgbd_result,width_scale,height_scale=rgbd_dinov2_inference.detect_inerence(rgbd_model, color_frame, depth_img_restore, conf=conf,target_imgWidth=target_imgWidth,target_imgHeight=target_imgHeight)
# 在帧上展示结果
annotated_frame = rgbd_result[0].plot()
# 进行dinov2分类分类器提取图像特征以及用faiss进行向量相似度搜索
rgbd_result, results, total_cls_results =rgbd_dinov2_inference.classify_memory_inference(rgbd_result,color_frame,width_scale,height_scale, clip_model, clip_processor,category_name_faiss, index_faiss,k=4)
# 可视化
rgbd_dinov2_inference.plot(rgbd_result,total_cls_results)
关键参数说明:
- 调用输入:color_frame:相机的图像帧。
- 结果输出:rgbd_result:检测框坐标与类别。 results:感知推理过程得到的短期记忆、长期记忆、知识记忆、网络记忆。 total_cls_results:感知类别结果。
4. 功能介绍
新零售场景物体多模态感知记忆推理模型是覆盖了新零售场景共计221种商品类别,对其具有感知分类识别的能力。
使用条件
检测的新零售物品必须在摄像头检测范围内。
功能详解
- 采集视频使用yolo-rgbd识别模型得到物体具体的定位位置与分割结果,用于构建特征图库以及给到分类模型进行细粒度分类。
- 基于构建的特征图库,使用clip分类器模型对图库进行特征提取,将提取后的特征向量保存为文件,作为特征向量库用于实时特征对比。
- 实时识别,根据检测器给出的位置结果在原图进行裁剪后,按照模型要求将图像大小改变为对应输入大小,将处理后的图像输入clip分类器模型。
- dinov2分类器对图片进行特征提取,faiss库将得到的特征与特征向量库中的特征进行对比,得到类别结果。
5. 更新日志
更新日期 | 更新内容 |
---|---|
2025.04.16 | 新增内容 |
6. 支持与反馈
- 了解更多关于睿尔曼的产品系列,请访问:睿尔曼官网
- 了解更多关于睿尔曼产品的使用问题,请访问:睿尔曼学院
- 咨询更多关于睿尔曼产品的相关问题,请邮件联系。官方邮箱:sales@realman-robot.com
- 实时了解更多关于睿尔曼产品的最新资讯,请关注:官方微信公众号
7、版权和许可协议
本项目遵循MIT许可证。