Elasticsearch:使用 Ollama 和 Go 开发 RAG 应用程序
作者:来自 Elastic Gustavo Llermaly
使用 Ollama 通过 Go 创建 RAG 应用程序来利用本地模型。
关于各种开放模型,有很多话要说。其中一些被称为 Mixtral 系列,各种规模都有,而一种可能不太为人所知的是 openbiollm,这是 Llama 3 针对医疗领域的改编版。通过实现它们的 API 来测试所有这些模型需要大量工作。但是,Ollama 允许我们使用友好的界面和简单的命令行来测试它们。
在本文中,我们将在 Golang 中构建一个 RAG 应用程序,使用 Ollama 作为 LLM 服务器,使用 Elasticsearch 作为向量数据库。
步骤
- 安装 Ollama
- 提取数据
- Go 中的 RAG 应用程序
安装 Ollama
什么是 Ollama?
Ollama 是一个框架,允许你使用 CLI 在本地下载和访问模型。使用简单的命令,我们可以下载、聊天和设置一个服务器,其中包含我们想要从我们的应用程序中使用的模型。
在此处下载 Ollama 安装程序:
https://ollama.com/
包含可用模型的库在此处:
https://ollama.com/library
安装 Ollama 后,我们可以通过运行其中一个可用模型来测试一切是否正常。让我们使用 3B 参数安装 llama3.2。该库包含下载和运行模型所需的命令:
我们将运行 3B 版本的命令:
ollama run llama3.2:latest
第一次,它会下载模型,然后在终端中打开聊天:
现在我们可以输入 /exit 退出并使用在此位置设置的服务器:http://localhost:11434。让我们测试端点以确保一切按预期运行。
Ollama 提供两种答案模式:generate 以提供单一答案,chat 以与模型进行对话:
生成 - generate
当我们只希望对单个问题得到单个答案而不需要其他答案时,我们会使用生成。
curl http://localhost:11434/api/chat -d '{"model": "llama3.2","stream": false,"messages": [{ "role": "user", "content": "Why Elastic is so cool?" }]
}'
默认情况下,答案以 stream: true 的形式生成,但我们将使用 stream: false,这样答案就只在一条消息中生成,并且更易于阅读。stream: true 在 UI 应用程序中很有用,因为 tokens 在生成时就会发送,而不是阻塞直到整个响应完成。
让我们继续讨论数据。
提取数据
让我们将一些医学文档作为文本和向量在 Elasticsearch 中编入索引。我们将使用这些来测试面向医学的模型(如 openbiollm)与一般模型相比的答案质量。
在开始之前,请确保我们已经创建了推理端点以使用 ELSER 作为我们的嵌入模型:
PUT _inference/sparse_embedding/my-elser-model
{"service": "elser", "service_settings": {"num_allocations": 1,"num_threads": 1}
}
现在,让我们继续使用 semantic_text 字段类型创建索引,该类型允许我们控制分块大小以及向量配置。这使我们的索引能够支持全文、语义和混合搜索。
PUT rag-ollama
{"mappings": {"properties": {"semantic_field": {"type": "semantic_text","inference_id": "my-elser-model"},"content": {"type": "text","copy_to": "semantic_field"}}}
}
现在,让我们索引这些文档:
POST _bulk
{"index":{"_index":"rag-ollama"}}
{"title":"JAK Inhibitors vs. Monoclonal Antibodies in Rheumatoid Arthritis Treatment","content":"This article compares the mechanisms of action, efficacy, and safety profiles of JAK inhibitors and monoclonal antibodies in rheumatoid arthritis treatment, including recent clinical trial data and real-world evidence. It discusses the intracellular signaling pathways targeted by JAK inhibitors, their rapid onset of action, and oral administration advantages. The article also covers the specific targets of various monoclonal antibodies, their long-term safety profiles, and the criteria for choosing between these two classes of drugs based on patient characteristics and disease severity."}
{"index":{"_index":"rag-ollama"}}
{"title":"Diagnostic Approach to Resistant Hypertension: Focus on Primary Aldosteronism","content":"This guide outlines the step-by-step diagnostic process for resistant hypertension, with a particular emphasis on screening and confirming primary aldosteronism. It details the use of aldosterone-renin ratio (ARR) testing as an initial screening tool, explaining proper patient preparation and interpretation of results. The guide also covers confirmatory tests such as the saline infusion test and captopril challenge test, their protocols, and diagnostic criteria. Additionally, it discusses the role of imaging studies in localizing aldosterone-producing adenomas and the importance of adrenal vein sampling in subtype classification of primary aldosteronism."}
{"index":{"_index":"rag-ollama"}}
{"title":"Gut Microbiota Diversity and Inflammatory Cytokine Production in IBD","content":"This study examines the relationship between gut microbiota diversity and the production of pro-inflammatory cytokines in inflammatory bowel diseases (IBD). It explores how reduced microbial diversity correlates with increased levels of cytokines such as TNF-α, IL-1β, and IL-6 in both Crohn's disease and ulcerative colitis. The research discusses specific bacterial species associated with anti-inflammatory effects and their mechanisms of action. Furthermore, it delves into potential therapeutic implications, including the use of prebiotics, probiotics, and fecal microbiota transplantation to modulate the gut microbiome and influence cytokine production. The study also touches on emerging microbiome-based interventions and their potential to complement existing IBD treatments."}
{"index":{"_index":"rag-ollama"}}
{"title":"Biological Therapy Selection in Rheumatoid Arthritis After csDMARD Failure","content":"This article provides a comprehensive framework for selecting appropriate biological therapy in rheumatoid arthritis patients who have not responded adequately to conventional synthetic Disease-Modifying Antirheumatic Drugs (csDMARDs). It discusses the various classes of biologics available, including TNF inhibitors, IL-6 inhibitors, B-cell depleting agents, and T-cell costimulation modulators. The article outlines key factors to consider in the decision-making process, such as disease activity scores, extra-articular manifestations, comorbidities, and patient preferences. It also addresses the importance of biomarkers and predictors of treatment response in guiding therapy selection. The piece concludes with a discussion on cycling versus switching mechanisms of action when faced with inadequate response to an initial biologic agent."}
{"index":{"_index":"rag-ollama"}}
{"title":"Hypertension Management in Chronic Kidney Disease: Special Considerations","content":"This review discusses the unique challenges in managing hypertension in patients with chronic kidney disease (CKD). It outlines the current recommendations for blood pressure targets in CKD patients, explaining how these differ based on the presence and degree of albuminuria. The article explores the preferred classes of antihypertensive medications in CKD, with a focus on renin-angiotensin system blockers and their renoprotective effects. It addresses the complexities of managing volume status in CKD and the role of diuretics. The review also covers the impact of proteinuria on treatment decisions and the need for more aggressive blood pressure control in heavily proteinuric patients. Finally, it discusses considerations for patients on dialysis and the phenomenon of reverse epidemiology in end-stage renal disease."}
完成了!现在我们已经准备好了模型和数据,我们可以将所有内容与我们的 Go 应用程序整合在一起。
Go 中的 RAG 应用程序
对于我们的 Go 应用程序,我们可以直接调用 Ollama 服务器,但我决定改用 parakeet。Parakeet 是一个基于 Go 文本创建 GenAI 应用程序的库。它提供了 Go 接口来抽象 HTTP 通信,此外还提供了用于嵌入、分块和内存等的帮助程序,因此创建应用程序变得非常容易。
我们将首先创建工作文件夹并设置依赖项:
mkdir ollama-rag
cd ollama-rag
go mod init ollama-rag
go get github.com/parakeet-nest/parakeet
go get github.com/elastic/go-elasticsearch/v8@latest
现在,创建一个 main.go 文件,其中包含测试一切是否配置正确的最少内容:
main.go
package mainimport ("github.com/parakeet-nest/parakeet/completion""github.com/parakeet-nest/parakeet/enums/option""github.com/parakeet-nest/parakeet/llm""fmt"
)func main() {ollamaUrl := "http://localhost:11434"model := "llama3.2:latest"options := llm.SetOptions(map[string]interface{}{option.Temperature: 0.5,})question := llm.GenQuery{Model: model,Prompt: "Why Elastic is so cool?, answer in one sentence",Options: options,}// We use generate because we are going to run this script to ask a single questionanswer, err := completion.Generate(ollamaUrl, question)if err != nil {log.Fatal("😡:", err)}fmt.Println(answer.Response)
}
运行它:
go run main.go
在终端中,你应该看到类似这样的答案:
Elastic, a company known for its innovative and user-friendly software solutions, has disrupted the traditional IT industry by empowering businesses to create, deploy, and manage applications quickly and reliably.
这个答案是基于 LLM 的训练数据,这不是我们可以提供或控制的,并且存在一些缺点:
- 信息可能是错误的
- 信息可能已过时
- 无法获取来源的引用
现在,让我们创建一个名为 elasticsearch/elasticsearch.go 的文件,使用 Go 的官方客户端连接 Elasticsearch,并能够使用我们文档中的信息根据我们的数据生成有根据的答案。
注:更多有关如何连接到 Elasticsearch,摄取数据,并进行搜索,请参阅文章 “Elasticsearch:运用 Go 语言实现 Elasticsearch 搜索 - 8.x”。
elasticsearch/elasticsearch.go
package elasticsearchimport ("context""encoding/json""fmt""strings""github.com/elastic/go-elasticsearch/v8""github.com/elastic/go-elasticsearch/v8/typedapi/types"
)// Initializing elasticsearch clientfunc EsClient() (*elasticsearch.TypedClient, error) {var cloudID = "" // your Elastic Cloud ID Herevar apiKey = "" // your Elastic ApiKey Herees, err := elasticsearch.NewTypedClient(elasticsearch.Config{CloudID: cloudID,APIKey: apiKey,})if err != nil {return nil, fmt.Errorf("unable to connect: %w", err)}return es, nil
}// Searching for documents and building the context
func SemanticRetriever(client *elasticsearch.TypedClient, query string, size int) (string, error) {// Perform the semantic searchres, err := client.Search().Index("rag-ollama").Query(&types.Query{Semantic: &types.SemanticQuery{Field: "semantic_field",Query: query,},}).Size(size).Do(context.Background())if err != nil {return "", fmt.Errorf("semantic search failed: %w", err)}// Prepare to format the resultsvar output strings.Builderoutput.WriteString("Documents found\n\n")// Iterate through the search hitsfor i, hit := range res.Hits.Hits {// Define a struct to unmarshal each documentvar doc struct {Title string `json:"title"`Content string `json:"content"`}// Unmarshal the document source into our structif err := json.Unmarshal(hit.Source_, &doc); err != nil {return "", fmt.Errorf("failed to unmarshal document %d: %w", i, err)}// Append the formatted document to our outputoutput.WriteString(fmt.Sprintf("Title\n%s\n\nContent\n%s\n", doc.Title, doc.Content))// Add a separator between documents, except for the last oneif i < len(res.Hits.Hits)-1 {output.WriteString("\n-----\n\n")}}// Return the formatted output as a stringreturn output.String(), nil
}
EsClient 函数使用提供的云凭据初始化 Elasticsearch 客户端,SemanticRetriever 执行语义查询以构建 LLM 回答问题所需的上下文。
要查找你的云 ID 和 API 密钥,请转到此链接。
让我们回到我们的 main.go 文件并使用上述功能进行更新以调用 Elasticsearch 并运行语义查询:这将构建 LLM 上下文:
main.go
package mainimport ("fmt""log""ollama-rag/elasticsearch""github.com/parakeet-nest/parakeet/completion""github.com/parakeet-nest/parakeet/enums/option""github.com/parakeet-nest/parakeet/llm"
)func main() {ollamaUrl := "http://localhost:11434"chatModel := "llama3.2:latest"question := `Summarize document: JAK Inhibitors vs. Monoclonal Antibodies in Rheumatoid Arthritis Treatment`size := 3esClient, err := elasticsearch.EsClient()if err != nil {log.Fatalln("😡:", err)}// Retrieve documents from semantic query to build contextdocumentsContent, nil := elasticsearch.SemanticRetriever(esClient, question, size)systemContent := `You are a helpful medical assistant. Only answer the questions based on found documents.Add references to the base document titles and be succint in your answers.`options := llm.SetOptions(map[string]interface{}{option.Temperature: 0.0,})queryChat := llm.Query{Model: chatModel,Messages: []llm.Message{{Role: "system", Content: systemContent},{Role: "system", Content: documentsContent},{Role: "user", Content: question},},Options: options,}fmt.Println()fmt.Println("🤖 answer:")// Answer the question_, err = completion.ChatStream(ollamaUrl, queryChat,func(answer llm.Answer) error {fmt.Print(answer.Message.Content)return nil})if err != nil {log.Fatal("😡:", err)}fmt.Println()
}
如你所见,我们将用户的问题连同与之相关的所有文档一起发送。这就是我们如何根据 Elasticsearch 中的文档获得答案。
我们可以通过运行代码进行测试:
go run .
你应该看到类似这样的内容:
According to the article "JAK Inhibitors vs. Monoclonal Antibodies in Rheumatoid Arthritis Treatment", JAK inhibitors and monoclonal antibodies are two classes of drugs used to treat rheumatoid arthritis (RA). The main difference between them lies in their mechanisms of action:
JAK inhibitors target intracellular signaling pathways, specifically the Janus kinase (JAK) pathway, which is involved in inflammation and immune response. They have a rapid onset of action and are administered orally.
Monoclonal antibodies target specific proteins involved in the inflammatory process, such as tumor necrosis factor-alpha (TNF-α), interleukin-6 (IL-6), and interleukin-17 (IL-17).
The article highlights that JAK inhibitors have a more favorable safety profile compared to monoclonal antibodies, with fewer gastrointestinal side effects. However, the choice between these two classes of drugs depends on patient characteristics and disease severity.
"References:"
"JAK Inhibitors vs. Monoclonal Antibodies in Rheumatoid Arthritis Treatment" (document title)
Parakeet 将为我们处理 Ollama 交互,包括 token 流!从现在开始,我们可以非常轻松地测试不同的模型,而无需更改代码。
除了主库中的模型外,我们还可以访问社区成员上传的模型。
要使用其中一个,我们只需确保先下载到 Ollama 中。例如,让我们测试 openbiollm:
ollama run taozhiyuai/openbiollm-llama-3:8b_q8_0
安装后,我们可以将它与我们的 Go 代码一起使用:
chatModel := "taozhiyuai/openbiollm-llama-3:8b_q8_0"
让我们用同样的问题再运行一次。你注意到有什么不同吗?
In rheumatoid arthritis treatment, JAK inhibitors and monoclonal antibodies are commonly used. This article discusses the benefits and drawbacks of both therapies. JAK inhibitors work by targeting intracellular signaling pathways involved in the immune response. They have a rapid onset of action and can be administered orally, making them convenient for patients. Recent clinical trial data has shown that JAK inhibitors are effective at reducing inflammation and slowing joint damage progression in rheumatoid arthritis. However, there is still ongoing research to fully understand their long-term safety profile. Monoclonal antibodies, on the other hand, specifically target molecules involved in the immune system. These drugs have been found to be highly effective in managing symptoms of rheumatoid arthritis and improving joint function. They can provide prolonged symptom control and are often used as first-line treatment options. However, due to their complexity and unique administration requirements, monoclonal antibodies may not be suitable for all patients. In conclusion, both J AK inhibitors and monoclonal antibodies have their own advantages and disadvantages in treating rheumatoid arthritis. The choice of therapy depends on individual patient characteristics and disease severity. Ongoing research will contribute to a deeper understanding of the efficacy and safety profiles of these treatments, ultimately leading to improved care for patients with rheumatoid arthritis.
openbiollm 模型似乎提供了更多有关技术术语的细节,但它没有遵循有关引用上下文中提供的文档和给出简短答案的说明。相比之下,Llama3.2 更好地遵循了说明。
你可以在此处找到完整的工作示例
结论
Ollama 提供了一种非常直接和简单的方法来下载和测试不同的开放模型,从知名的模型到社区成员微调的模型。将它与 Parakeet 和官方 Elasticsearch Go 客户端配对,可以非常轻松地创建 RAG 应用程序。此外,通过使用 semantic_text 字段类型,你可以创建一个使用 ELSER(Elastic Sparse 嵌入模型)的语义查询就绪索引,而无需任何其他配置,从而简化了分块、索引和向量查询过程。
Elasticsearch 与行业领先的 Gen AI 工具和提供商进行了原生集成。查看我们的网络研讨会,了解如何超越 RAG 基础知识,或构建可用于生产的应用程序 Elastic Vector Database。
要为你的用例构建最佳搜索解决方案,请立即开始免费云试用或在你的本地机器上试用 Elastic。
原文:Using Ollama and Go for RAG applications - Elasticsearch Labs
相关文章:

Elasticsearch:使用 Ollama 和 Go 开发 RAG 应用程序
作者:来自 Elastic Gustavo Llermaly 使用 Ollama 通过 Go 创建 RAG 应用程序来利用本地模型。 关于各种开放模型,有很多话要说。其中一些被称为 Mixtral 系列,各种规模都有,而一种可能不太为人所知的是 openbiollm,这…...

Windows平台ROBOT安装
Windows环境下ROBOT的安装,按照下文进行部署ROBOT的前提是你的python已安装并且环境变量已设置好. 一、安装setuptools 1、下载后安装 https://pypi.python.org/pypi/setuptools/ 下载你需要的包 setuptools-75.6.0.tar.gz 解压下载的包在命令行中进入该包,敲击如下命令后…...

【动态规划篇】穿越算法迷雾:约瑟夫环问题的奇幻密码
欢迎拜访:羑悻的小杀马特.-CSDN博客 本篇主题:带你众人皆知的约瑟夫环问题 制作日期:2024.12.29 隶属专栏:C/C题海汇总 目录 引言: 一约瑟夫环问题介绍: 11问题介绍: 1.2起源与历史背景&…...

代码随想录算法训练营第51期第32天 | 理论基础、509. 斐波那契数、70. 爬楼梯、746. 使用最小花费爬楼梯
理论基础 动态规划:dp,每一个状态都是由上个状态推导出来的,因为我是先写完三道题再看理论的,所以有点感概; 确定dp数组(dp table)以及下标的含义确定递推公式dp数组如何初始化确定遍历顺序举…...

爱思唯尔word模板
爱思唯尔word模板 有时候并不一定非得latex https://download.csdn.net/download/qq_38998213/90199214 参考文献书签链接...
每日一题 354. 俄罗斯套娃信封问题
354. 俄罗斯套娃信封问题 需要对信封排序 ,重点是再宽度相同时,逐步减少其高度 class Solution { public:int maxEnvelopes(vector<vector<int>>& envelopes) {sort(envelopes.begin(),envelopes.end(),[](const vector<int>&a,const v…...

ASP.net网站的注册、登录和密码修改的操作详解
一、进入注册、登录和密码修改操作详解 ASP.net网站为用户提供不同权限状态下的操作界面。根据用户登录状态,页面会显示不同的选项。 已登录用户的操作 图1 登录后操作界面 当用户已登录系统时,会显示以下内容和功能: 1. 欢迎信息 页面顶部…...

2024.12.29(进程线程实现并发服务器)
作业 多进程多线程并发服务器实现一遍提交。 服务器 #include <myhead.h> #define PORT 12345 #define IP "192.168.124.123"void *fun(void *fd) {int newfd *(int *)fd;char buff[1024];while(1){int res recv(newfd,buff,sizeof(buff),0);if(res 0){p…...

如何在 Ubuntu 上安装 PyTorch
简介 PyTorch 因其易用性、动态计算图和高效性而日益流行,成为实现深度学习模型的首选。如果你想探索这个工具并学习如何在 Ubuntu 上安装 PyTorch,本指南将对你有所帮助! 在本教程中,我们将引导你完成在 Ubuntu 系统上使用 Pip…...

8-Gin 中间件 --[Gin 框架入门精讲与实战案例] 【文末有测试代码】
路由中间件 Gin 是一个用 Go (Golang) 编写的 HTTP web 框架。它以性能好、中间件支持灵活著称,非常适合用来构建微服务或 RESTful API 服务。下面我将提供三个使用 Gin 的路由中间件的完整示例。 示例 1: 简单的日志记录中间件 这个中间件会在每个请求处理前后打…...

【潜意识Java】深入详细理解分析Java中的toString()方法重写完整笔记总结,超级详细。
目录 一、toString() 方法是啥? (一)默认的 toString() 方法 (二)toString() 方法的作用 二、为啥要重写 toString() 方法? (一)提高代码的可读性 (二)…...

【论文笔记】Contrastive Learning for Sign Language Recognition and Translation
🍎个人主页:小嗷犬的个人主页 🍊个人网站:小嗷犬的技术小站 🥭个人信条:为天地立心,为生民立命,为往圣继绝学,为万世开太平。 基本信息 标题: Contrastive Learning for…...

Gitlab17.7+Jenkins2.4.91实现Fastapi/Django项目持续发布版本详细操作(亲测可用)
一、gitlab设置: 1、进入gitlab选择主页在左侧菜单的下面点击管理员按钮。 2、选择左侧菜单的设置,选择网络,在右侧选择出站请求后选择允许来自webhooks和集成对本地网络的请求 3、webhook设置 进入你自己的项目选择左侧菜单的设置ÿ…...
一起来看--红黑树
【欢迎关注编码小哥,学习更多实用的编程方法和技巧】 红黑树是一种自平衡的二叉搜索树,广泛应用于计算机科学中,尤其是在实现关联数组和集合时。它的设计旨在确保在最坏情况下,基本动态集合操作(如插入、删除和查找&am…...

SpringBoot整合篇 05、Springboot整合Redission
文章目录 前言Redission详细配置步骤pom依赖application.yaml配置类CacheConfigEnvironmentContext RedissionController单测 前言 本篇博客是SpringBoot整合Redission,若文章中出现相关问题,请指出! 所有博客文件目录索引:博客…...

供应链系统设计-供应链中台系统设计(六)- 商品中心概念篇
概述 我们在供应链系统设计-中台系统设计系列(五)- 供应链中台实践概述 中描述了什么是供应链中台,供应链中台主要包含了那些组成部门。包括业务中台、通用中台等概念。为了后续方便大家对于中台有更深入的理解,我会逐一针对中台…...

胡闹厨房练习(三)
ScriptableObject 一、初步了解 1、实质:是一种特殊类型的Unity对象, 2、作用:用于存储大量数据,而不必依附于游戏场景中的某个GameObject。 3、特点: 可以在不增加场景中对象数量的情况下,管理和存储复杂的数据结构、配置信息、游戏状态等。 4、适用:非常适合用来…...
关于ESD(静电放电)等级的划分
关于ESD(静电放电)等级的划分,主要依据不同的测试模型和测试标准。以下是对HBM(人体模型)和CDM(充电器件模型)两种测试模型下ESD等级划分的详细解释: HBM ESD等级划分 HBM ESD等级…...

探究步进电机与输入脉冲的关系
深入了解步进电机 前言一、 步进电机原理二、 细分三、脉冲数总结 前言 主要是探究以下内容: 1、步进电机的步进角。 2、什么是细分。 3、脉冲的计算。 最后再扩展以下STM32定时器的计算方法。 一、 步进电机原理 其实语言描述怎么样都不直观,我更建议…...

基于YOLOV5+Flask安全帽RTSP视频流实时目标检测
1、背景 在现代工业和建筑行业中,安全始终是首要考虑的因素之一。特别是在施工现场,工人佩戴安全帽是确保人身安全的基本要求。然而,人工监督难免会有疏漏,尤其是在大型工地或复杂环境中,确保每个人都佩戴安全帽变得非…...

Windows内置的服务器IIS(Internet Information Services)托管网站
一. 安装IIS 打开控制面板:在开始菜单搜索“控制面板”并打开它。程序和功能:点击“程序”然后选择“程序和功能”。启用或关闭Windows功能:在左侧菜单中选择“启用或关闭Windows功能”。查找并勾选IIS:在弹出的窗口中,…...
虚幻引擎结构之UObject
一. UObject 的介绍 UObject 是虚幻引擎中的核心基础类,所有其他游戏对象和资源类都直接或间接地继承自它。作为虚幻引擎的基石,UObject 提供了多项关键功能,包括内存管理、序列化、反射(introspection)、垃圾回收以及元数据支持。在虚幻引擎中,UObject 类的实例通常被称…...
js的Reflect对象
Reflect 对象是 JavaScript ES6 中引入的一个内建对象,它提供了一系列与对象操作相关的方法。这些方法与 Object 对象上的方法类似,但在行为上有一些差异,并且更加规范和统一。Reflect 对象并不是一个构造函数,不能被 new 操作符调…...
this指向了谁?
看函数在执行的时候是如何调用的, 1 如果这个函数是用普通函数调用模式来进行调用,它内部的this指向了window; 2 如果一个函数在调用的时候是通过对象方法模式来进行调用,则它内部的this就是我们的对象; 3 如果一个函数在调用的时候通过构…...

基于Resnet、LSTM、Shufflenet及CNN网络的Daily_and_Sports_Activities数据集仿真
在深度学习领域,不同的网络结构设计用于解决特定的问题。本文将详细分析四种主流网络结构:卷积神经网络(CNN)、残差网络(ResNet)、长短期记忆网络(LSTM)和洗牌网络(Shuff…...

mac系统vsCode中使用Better Comments在.vue文件里失效
问题:关于Better Comments默认在html、TS、JS中有效,在vue中无效,需要单独进行配置 windows系统可以参考友链Better Comments(注释高亮)在vue文件里失效的问题 关于Better Comments电脑的配置路径: Windows系统&…...

UE5.3 C++ Ceiusm中的POI 制作3DUI 结合坐标转化
一.核心思路WidgetComponent CesiumGloberAnchor 二.先制作POI 创建C Actor来制作,APOI。直接上代码 #pragma once#include "CoreMinimal.h" #include "GameFramework/Actor.h" #include "CesiumGlobeAnchorComponent.h" #includ…...

一起学Git【第六节:查看版本差异】
git diff是 Git 版本控制系统中用于展示差异的强大工具。他可以用于查看文件在工作区、暂存区和版本库之间的差异、任意两个指定版本之间的差异和两个分支之间的差异等,接下来进行详细的介绍。 1.显示工作区与暂存区之间的差异 # 显示工作区和暂存区之间的差异,后面不加参数…...
numpy np.newaxis介绍
np.newaxis 是 NumPy 中用于增加数组维度的关键字。它的作用是为数组插入一个新的维度,从而改变数组的形状(shape)。 基本用法 np.newaxis 等价于 None,可以作为索引使用,用于在指定位置增加一个维度。增加的维度的大…...

小程序配置文件 —— 16 项目配置文件和配置 sass
目录 项目配置文件配置 sass 项目配置文件 在创建项目的时候,每个项目的根目录生成两个 config.json 文件(project.config.json 和 project.private.config.json ),用于保存开发者在工具上做的个性化配置,例如和编译有…...