当前位置: 首页 > news >正文

Ollama 运行视觉语言模型LLaVA

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.lryc.cn/news/454001.html

相关文章:

  • gdb 调试 linux 应用程序的技巧介绍
  • Java项目实战II基于Java+Spring Boot+MySQL的房产销售系统(源码+数据库+文档)
  • aws(学习笔记第一课) AWS CLI,创建ec2 server以及drawio进行aws画图
  • 【Python】Eventlet 异步网络库简介
  • 【JNI】数组的基本使用
  • React跨平台
  • 如何在 SQL 中更新表中的记录?
  • 宠物饮水机的水箱低液位提醒如何实现?
  • EXCEL_光标百分比
  • (一)Web 网站服务之 Apache
  • 英语词汇小程序小程序|英语词汇小程序系统|基于java的四六级词汇小程序设计与实现(源码+数据库+文档)
  • AI学习指南深度学习篇-学习率衰减的实现机制
  • My_qsort() -自己写的 qsort 函数
  • 《向量数据库指南》——Mlivus Cloud打造生产级AI应用利器
  • Electron 进程通信
  • Kubernetes资源详解
  • C++11之线程
  • 界星空科技漆包线行业称重系统
  • RabbitMQ的高级特性-事务
  • Qt Linguist手册
  • 【简介Sentinel-1】
  • 第 17 场小白入门赛蓝桥杯
  • @antv/x6 导出图片下载,或者导出图片为base64由后端去处理。
  • 从零到精通:AI大模型的全方位学习路径解析,非常详细收藏我这一篇就够了
  • PowerShell脚本在自动化Windows开发工作流程中的应用
  • 【力扣 | SQL题 | 每日四题】力扣1783,1757,1747,1623,1468,1661
  • 《深入探究 C++中的函数模板特化:开启编程新境界》
  • RTEMS面试题汇总及参考答案
  • 螺蛳壳里做道场:老破机搭建的私人数据中心---Centos下Docker学习03(网络及IP规划)
  • BLOOM 模型的核心原理、局限与未来发展方向解析