Ollama 运行视觉语言模型LLaVA

embedded/2024/10/10 23:47:01/

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/embedded/124599.html

相关文章

数据结构 实验1

1、 #include<stdio.h> #include<string.h> #define N 5 struct patient {int number;char name[20];char symptom[100]; };void readin(struct patient *p) {int i;printf("输入病人的信息&#xff1a;病号&#xff0c;姓名&#xff0c;症状&#xff1a;&q…

env-entry元素

env-entry 元素的详细讲解 1. 定义 env-entry 元素用于将环境条目绑定到 SBB 的 JNDI&#xff08;Java Naming and Directory Interface&#xff09;组件环境中。这使得 SBB 可以在运行时访问配置数据&#xff0c;如数据库连接字符串、服务 URL 等。 2. 功能 配置管理: 允许…

Linux学习笔记(八):awk实战小案例--把数字金额用汉字表示

Linux学习笔记&#xff08;八&#xff09;&#xff1a;awk实战小案例 怎么把数字金额用汉字表示&#xff1f; 思维过程 1.创建一个awk脚本文件 2.数据初始化 awk分为三部分: BEGIN{} #主要初始化一些数据&#xff0c;定义一些静态值 ...#中间代码 END{} **我们需要初始化一个…

Sharding 分页原理分析

优质博文&#xff1a;IT-BLOG-CN 如果业务上需要执行如下分页查询&#xff0c;Sharding-JDBC如何执行分页查询的&#xff1f; 官方文档 select * from student_time ORDER BY create_time ASC limit 1000, 5;Sharding-JDBC分页查询时在每个分表中都查询1005条数据&#xff0c…

SQL基础教程

SQL基础教程 目录 简介创建数据库和表 2.1 创建数据库 2.2 创建表使用SELECT语句查询数据 3.1 基本SELECT语句 3.2 使用WHERE子句表的连接操作 4.1 INNER JOIN 4.2 LEFT JOIN 4.3 RIGHT JOIN修改数据&#xff1a;INSERT、UPDATE、DELETE 5.1 INSERT语句 5.2 UPDATE语句 5.3 D…

PHP魔幻(术)方法

PHP中的魔幻方法&#xff0c;也被称为魔术方法&#xff08;Magic Methods&#xff09;&#xff0c;是一组具有特殊功能的方法。这些方法在PHP中有固定的名称&#xff0c;并且会在特定的时机自动被PHP调用&#xff0c;而无需开发者显式调用。它们通常用于执行一些特殊的操作&…

信息安全工程师(38)防火墙类型与实现技术

一、防火墙类型 按软、硬件形式分类 软件防火墙&#xff1a;通过软件实现防火墙功能&#xff0c;通常安装在个人计算机或服务器上&#xff0c;用于保护单个设备或小型网络。硬件防火墙&#xff1a;采用专门的硬件设备来实现防火墙功能&#xff0c;通常部署在企业网络边界或数据…

ERP智能进销存管理系统 专业用于企业采购+销售+资金 带完整的安装代码包以及搭建部署教程

系统概述 在当今竞争激烈的市场环境中&#xff0c;企业对于采购、销售和资金管理的需求愈发复杂和精细。传统的进销存管理方式已经无法满足现代企业的需求&#xff0c;因此&#xff0c;开发一款高效、智能的ERP进销存管理系统显得尤为重要。本文将详细介绍这款ERP智能进销存管…