Ollama 运行视觉语言模型LLaVA

news/2024/10/11 8:04:47/

Ollama的LLaVA(大型语言和视觉助手)模型集已更新至 1.6 版,支持:

  • 更高的图像分辨率:支持高达 4 倍的像素,使模型能够掌握更多细节。
  • 改进的文本识别和推理能力:在附加文档、图表和图表数据集上进行训练。
  • 更宽松的许可证:通过 Apache 2.0 许可证或 LLaMA 2 社区许可证分发。

这些模型有三种参数大小。7B、13B 和新的 34B 模型:

  • ollama run llava:7b
  • ollama run llava:13b
  • ollama run llava:34b

NSDT工具推荐: Three.js AI纹理开发包 - YOLO合成数据生成器 - GLTF/GLB在线编辑 - 3D模型格式在线转换 - 可编程3D场景编辑器 - REVIT导出3D模型插件 - 3D模型语义搜索引擎 - AI模型在线查看 - Three.js虚拟轴心开发包 - 3D模型在线减面 - STL模型在线切割

1、Ollama视觉模型使用方法

命令行使用方法:

要将视觉模型与 ollama run 结合使用,请使用文件路径引用 .jpg 或 .png 文件,例如上图:

% ollama run llava "describe this image: ./art.jpg"
The image shows a colorful poster featuring an illustration of a cartoon character with spiky hair. Above the character's head is a crown, suggesting royalty or high status. On the right side of the poster, there is text in French that reads "Jean-Michel Basquiat,"

在Python代码中调用方法如下:

import ollamares = ollama.chat(model="llava",messages=[{'role': 'user','content': 'Describe this image:','images': ['./art.jpg']}]
)print(res['message']['content'])

在JavaScript中的调用方法如下所示:

import ollama from 'ollama'const res = await ollama.chat({model: 'llava',messages: [{role: 'user',content: 'Describe this image:'images: ['./art.jpg']}]
})console.log(res.message.content)

注意:在 Ollama Python 和 JavaScript 库以及 REST API 中,可以在 images 参数中提供 base64 编码的文件。有关向视觉模型提供图像的更多示例,请参阅完整的 API 文档。

2、应用示例

对象检测:

% ollama run llava "tell me what do you see in this picture? ./pic.jpg"
In the image, a man wearing blue and white is holding video game controllers in his hands while smiling. His arms are raised above his head as he plays with the virtual reality gaming devices. The man appears to be enjoying himself and immersed in his gaming experience.

文字识别:

% ollama run llava "what does the text say? ./wordart.png"
This is an image with a capitalized, bolded text of "ollama." The background is black and the letters are yellow, which create a contrasting appearance. Although the words "ollama" make up the majority of the image, it could also be seen as part of a sign or advertisement due to its brightness and prominent font style.

原文链接:Ollama 运行视觉模型 - BimAnt


http://www.ppmy.cn/news/1537342.html

相关文章

zookeeper ——watcher

这应该不是目录 1.watcher定义和说明1.1定义1.2特性1.3watcher的通知状态Watcher.Event.KeeperState1.4watcher的事件类型Event.EventType1.5基本流程 1.watcher定义和说明 1.1定义 在ZooKeeper中,Watcher是一种机制,用于在节点(znode&#…

uni-app如何搭建项目(一步一步教程)

来来来,看这里 uni-app新建项目教程uni-app项目结构 首先我们要有一个HBuilder这个软件,然后我们来搭建uni-app项目 uni-app新建项目教程 首先我们打开这个HBuilder软件,好我们就出现这个界面,我们点击新建项目   然后我们选择…

Android开发视频预览效果

Android开发视频预览效果 视频播放不是一个简单的事情,得有暂停,继续播放等功能,屏幕的适配也是头疼的事情 一、思路: 引用的是腾讯播放器TXVodPlayer 二、效果图: 图片不是很直观,也可以看下视频 And…

旅游平台|智慧旅游平台|基于java的智慧旅游平台设计与实现(源码+数据库+文档)

智慧旅游平台 目录 基于java的智慧旅游平台设计与实现 一、前言 二、系统功能设计 三、系统实现 四、数据库设计 五、核心代码 六、论文参考 七、最新计算机毕设选题推荐 八、源码获取: 博主介绍:✌️大厂码农|毕设布道师,阿里云开发…

Windows 编译 FFmpeg 源码详细教程

FFmpeg FFmpeg 是一个开源的多媒体框架,它包括了一整套工具和库,可以用来处理(转码、转换、录制、流式传输等)音频和视频。FFmpeg 支持广泛的音视频格式,并且可以在多种操作系统上运行,包括 Windows、Linux 和 macOS。 FFmpeg 的主要组件包括: ffmpeg:这是一个命令行工…

系统架构设计师-下午案例题(2018年下半年)

1.某文化产业集团委托软件公司开发一套文化用品商城系统,业务涉及文化用品销售、定制、竞拍和点评等板块,以提升商城的信息化建设水平。该软件公司组织项目组完成了需求调研,现已进入到系统架构设计阶段。考虑到系统需求对架构设计决策的影响,项目组先列出了可能影响系统架…

服装生产管理的数字化转型:SpringBoot框架

4 系统设计 4.1 系统结构设计 在结构设计过程中,首先对系统进行需求分析,然后进行系统初步设计,将系统功能模块细化,具体分析每一个功能模块具体应该首先哪些功能,最后将各个模块进行整合,实现系统结构的…

消费者Rebalance机制

优质博文:IT-BLOG-CN 一、消费者Rebalance机制 在Apache Kafka中,消费者组 Consumer Group会在以下几种情况下发生重新平衡Rebalance: 【1】消费者加入或离开消费者组: 当一个新的消费者加入消费者组或一个现有的消费者离开消费…