Elasticsearch:在满意度调查中实现并使用情绪分析器

news2024/12/24 0:33:06

如果你通过博客或新闻关注 Elastic,你已经知道在最新版本的 Elasticsearch 中已经提供了用于自然语言处理 (NLP) 的资源。事实上,在我之前的博客文章中,我已经推出了很多关于 NLP 的博文。请详细阅读 “Elastic:开发者上手指南” 中的 “NLP - 自然语言处理” 部分。在今天的练习中,我们将进一步使用一个例子来展示如何使用一个情感分析器来识别情绪。我们可以针对用户的反馈进行统计:positive,nagative 或者 neutral。

满意度调查

在满意度调查中,我们有如下的 4 个问题:

1)How do you rate the customer service provided by the company?

答案有四个:Very good, Good, Bad, Too bad

2)The information about the product/service was passed on clearly and correctly?

答案有两个:A: Yes, Not

3)How would you describe our product(s)/service(s)?

答案有八个:Reliable, Very expensive, Cheap and good, Very qualified, Useful, Little qualified, is not reliable, Ineffective

4)How satisfied are you with our company?

答案有五个:Very satisfied, Satisfied, not very satisfied, Dissatisfied, Very unsatisfied,

模型

我们将使用 DistilBERT base uncased finetuned SST-2 模型。这个也是在之前文章 “Elasticsearch:如何部署 NLP:情绪分析示例” 中所使用的模型。这个模型,我们可以在地址 distilbert-base-uncased-finetuned-sst-2-english · Hugging Face 找到。在网站站中,我们可以看到如下的一个例子:

从上面的例子中,我们可以看出来。给定一个句子,它可以帮我们进行情绪判断:正面或者负面。

安装 

如果你还没有安装好自己的 Elasticsearch 及 Kibana,我们可以按照如下的方式来安装一个没有安全的 Elasticsearch 集群:

docker-compose.yml

version: '3.8'

services:

  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:8.6.2
    container_name: elasticsearch-8.6.2
    environment:
      - node.name=elasticsearch
      - xpack.security.enabled=false
      - discovery.type=single-node
      - "ES_JAVA_OPTS=-Xms1g -Xmx1g"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - esdata1:/usr/share/elasticsearch/data
    ports:
      - 9200:9200

  kibana:
    image: docker.elastic.co/kibana/kibana:8.6.2
    container_name: kibana-8.6.2
    restart: always
    environment:
      ELASTICSEARCH_URL: "http://elasticsearch:9200"
    ports:
      - 5601:5601
    depends_on:
      - elasticsearch

volumes:
  esdata1:
    driver: local

我们使用如下的命令来启动:

docker-compose up
from elasticsearch import Elasticsearch
from pathlib import Path
from eland.ml.pytorch import PyTorchModel
from eland.ml.pytorch.transformers import TransformerModel


def get_client_es():
    return Elasticsearch(
        hosts=[{'scheme': 'http', 'host': 'localhost', 'port': 9200}],
        request_timeout=300,
        verify_certs=False
    )


if __name__ == '__main__':
    tm = TransformerModel("distilbert-base-uncased-finetuned-sst-2-english", "text_classification")
    tmp_path = "models"
    Path(tmp_path).mkdir(parents=True, exist_ok=True)
    model_path, config, vocab_path = tm.save(tmp_path)
    ptm = PyTorchModel(get_client_es(), tm.elasticsearch_model_id())
    ptm.import_model(model_path=model_path, config_path=None, vocab_path=vocab_path, config=config)

等上述的命令完成后,我们的 Elasticsearch 将可以在地址 http://localhost:9200 进行访问。 我们可以在 http://localhost:5601 访问 Kibana。

上传模型

我们在本地创建如下的 Python 代码及 requirements.txt 文件:

requirements.txt

elasticsearch~=8.6.2
path
eland~=8.3.0
torch==1.11
transformers
sentence-transformers>=2.1.0

main.py

from elasticsearch import Elasticsearch
from pathlib import Path
from eland.ml.pytorch import PyTorchModel
from eland.ml.pytorch.transformers import TransformerModel


def get_client_es():
    return Elasticsearch(
        hosts=[{'scheme': 'http', 'host': 'localhost', 'port': 9200}],
        request_timeout=300,
        verify_certs=False
    )


if __name__ == '__main__':
    tm = TransformerModel("distilbert-base-uncased-finetuned-sst-2-english", "text_classification")
    tmp_path = "models"
    Path(tmp_path).mkdir(parents=True, exist_ok=True)
    model_path, config, vocab_path = tm.save(tmp_path)
    ptm = PyTorchModel(get_client_es(), tm.elasticsearch_model_id())
    ptm.import_model(model_path=model_path, config_path=None, vocab_path=vocab_path, config=config)

我们按照如下步骤来运行:

pip3 install -r requirements.txt

我们接下来按照如下的命令来上传模型: 

python main.py 

从上面的输出中,我们可以看出来当前的 License 是不对的。我们需要按照如下的方式来启动白金版试用:

这样我们就启动了白金版试用功能。

我们再次运行上面的命令:

 python main.py 

这样,将下载模型并执行上传。 在上传过程中,你将在控制台上看到如下消息: 

上面显示我们的下载及上传是成功的。

我们回到 Kibana 的界面进行查看:

点击上面的 Start Deployment:

这样,我们就成功地启动了模型。我们可以通过如下的 API 来检查已经安装的模型:

GET /_ml/trained_models/

创建 index mapping

我们接下来创建如下的一个索引 mapping:

PUT survey
{
  "mappings": {
    "properties": {
      "user": {
        "type": "text"
      },
      "question_A": {
        "properties": {
          "question": {
            "type": "text"
          },
          "answer": {
            "type": "text"
          }
        }
      },
      "question_B": {
        "properties": {
          "question": {
            "type": "text"
          },
          "answer": {
            "type": "text"
          }
        }
      },
      "question_C": {
        "properties": {
          "question": {
            "type": "text"
          },
          "answer": {
            "type": "text"
          }
        }
      },
      "question_D": {
        "properties": {
          "question": {
            "type": "text"
          },
          "answer": {
            "type": "text"
          }
        }
      }
    }
  }
}

该索引的映射由 question 字段和 user 字段组成。 你可能会觉得奇怪,我有几个字段来定义 questions 而不是使用列表,但不幸的是,我在将推理处理器与列表一起使用时遇到了问题。 

推理处理器 - inference processor

现在让我们进入最酷的部分。 通过索引 answer,我们将推断出每个 answer 的分类是什么。 在这部分中,我们将使用推理处理器,该处理器将使用 distilbert-base-uncased-finetuned-sst-2-english 模型,分析响应并在 form_answer_predicted 字段中设置分类。

对于每个答案,我们都会有评分,然后我添加了脚本处理器以根据答案生成最终用户满意度。

Ingest pipeline 将是这样的:

PUT _ingest/pipeline/text-answer-mode-analysis
{
  "description": "Apply response analyzer using a sentiment analysis model",
  "processors": [
    {
      "inference": {
        "model_id": "distilbert-base-uncased-finetuned-sst-2-english",
        "target_field": "question_A.form_answer_predicted",
        "field_map": {
          "question_A.answer": "text_field"
        }
      }
    },
    {
      "inference": {
        "model_id": "distilbert-base-uncased-finetuned-sst-2-english",
        "target_field": "question_B.form_answer_predicted",
        "field_map": {
          "question_B.answer": "text_field"
        }
      }
    },
    {
      "inference": {
        "model_id": "distilbert-base-uncased-finetuned-sst-2-english",
        "target_field": "question_C.form_answer_predicted",
        "field_map": {
          "question_C.answer": "text_field"
        }
      }
    },
    {
      "inference": {
        "model_id": "distilbert-base-uncased-finetuned-sst-2-english",
        "target_field": "question_D.form_answer_predicted",
        "field_map": {
          "question_D.answer": "text_field"
        }
      }
    },
    {
      "script": {
        "lang": "painless",
        "source": """
            int countPositive, countNegative = 0; 
            ArrayList list = new ArrayList();
            list.add(ctx['question_A'].form_answer_predicted.predicted_value);
            list.add(ctx['question_B'].form_answer_predicted.predicted_value);
            list.add(ctx['question_C'].form_answer_predicted.predicted_value);
            list.add(ctx['question_D'].form_answer_predicted.predicted_value);
            for (int i = 0; i < list.size(); i++) {
              if(list[i].equals("POSITIVE")) {
                countPositive++;
              } else {
                countNegative++
              }
            }
            if(countPositive > countNegative) {
              ctx['user_satisfaction'] = "POSITIVE"
            } else if (countPositive == countNegative) {
              ctx['user_satisfaction'] = "NEUTRAL"
            } else {
              ctx['user_satisfaction'] = "NEGATIVE"
            }
          """
      }
    }
  ]
}

在上面,我们定义了一个叫做 text-answer-mode-analysis 的 ingest pipeline。它把几个问题都分别进行情绪分析,并最终使用 script 处理器来计算出这个人的情绪是:POSITIVE,NEGATIVE 或者是 NEUTRAL 的。

写入文档

我们现在准备索引数据。 我使用 Bulk API来索引数据并将管道设置为在索引时运行。

PUT survey/_bulk?pipeline=text-answer-mode-analysis
{"index": {"_id": 1}}
{"user":"xpto", "question_A": {"question":"How do you rate the customer service provided by the company?", "answer": "good"}, "question_B": {"question":"The information about the product/service was passed on clearly and correctly", "answer": "no"}, "question_C": {"question":"How would you describe our product(s)/service(s)?", "answer": "Useful"}, "question_D": {"question":"How satisfied are you with our company?", "answer": "Dissatisfied"}}
{"index": {"_id": 2}}
{"user":"xpto", "question_A": {"question":"How do you rate the customer service provided by the company?", "answer": "good"}, "question_B": {"question":"The information about the product/service was passed on clearly and correctly", "answer": "yes"}, "question_C": {"question":"How would you describe our product(s)/service(s)?", "answer": "Useful"}, "question_D": {"question":"How satisfied are you with our company?", "answer": "Satisfied"}}
{"index": {"_id": 3}}
{"user":"xpto", "question_A": {"question":"How do you rate the customer service provided by the company?", "answer": "bad"}, "question_B": {"question":"The information about the product/service was passed on clearly and correctly", "answer": "no"}, "question_C": {"question":"How would you describe our product(s)/service(s)?", "answer": "Very expensive"}, "question_D": {"question":"How satisfied are you with our company?", "answer": "Dissatisfied"}}

请注意,在上面的每个文档中,它都含有四个问题,并含有相应的答案。

我们可以通过如下命令来查看被摄入的文档:

GET survey/_search?filter_path=**.hits

上面命令搜索的结果是:

{
  "hits": {
    "hits": [
      {
        "_index": "survey",
        "_id": "1",
        "_score": 1,
        "_source": {
          "question_C": {
            "form_answer_predicted": {
              "predicted_value": "POSITIVE",
              "prediction_probability": 0.9997634803424444,
              "model_id": "distilbert-base-uncased-finetuned-sst-2-english"
            },
            "question": "How would you describe our product(s)/service(s)?",
            "answer": "Useful"
          },
          "question_D": {
            "form_answer_predicted": {
              "predicted_value": "NEGATIVE",
              "prediction_probability": 0.9997315864531746,
              "model_id": "distilbert-base-uncased-finetuned-sst-2-english"
            },
            "question": "How satisfied are you with our company?",
            "answer": "Dissatisfied"
          },
          "question_A": {
            "form_answer_predicted": {
              "predicted_value": "POSITIVE",
              "prediction_probability": 0.9998161198125766,
              "model_id": "distilbert-base-uncased-finetuned-sst-2-english"
            },
            "question": "How do you rate the customer service provided by the company?",
            "answer": "good"
          },
          "question_B": {
            "form_answer_predicted": {
              "predicted_value": "NEGATIVE",
              "prediction_probability": 0.9964459731735253,
              "model_id": "distilbert-base-uncased-finetuned-sst-2-english"
            },
            "question": "The information about the product/service was passed on clearly and correctly",
            "answer": "no"
          },
          "user": "xpto",
          "user_satisfaction": "NEUTRAL"
        }
      },
      {
        "_index": "survey",
        "_id": "2",
        "_score": 1,
        "_source": {
          "question_C": {
            "form_answer_predicted": {
              "predicted_value": "POSITIVE",
              "prediction_probability": 0.9997634803424444,
              "model_id": "distilbert-base-uncased-finetuned-sst-2-english"
            },
            "question": "How would you describe our product(s)/service(s)?",
            "answer": "Useful"
          },
          "question_D": {
            "form_answer_predicted": {
              "predicted_value": "POSITIVE",
              "prediction_probability": 0.9997212937948691,
              "model_id": "distilbert-base-uncased-finetuned-sst-2-english"
            },
            "question": "How satisfied are you with our company?",
            "answer": "Satisfied"
          },
          "question_A": {
            "form_answer_predicted": {
              "predicted_value": "POSITIVE",
              "prediction_probability": 0.9998161198125766,
              "model_id": "distilbert-base-uncased-finetuned-sst-2-english"
            },
            "question": "How do you rate the customer service provided by the company?",
            "answer": "good"
          },
          "question_B": {
            "form_answer_predicted": {
              "predicted_value": "POSITIVE",
              "prediction_probability": 0.9997805442484351,
              "model_id": "distilbert-base-uncased-finetuned-sst-2-english"
            },
            "question": "The information about the product/service was passed on clearly and correctly",
            "answer": "yes"
          },
          "user": "xpto",
          "user_satisfaction": "POSITIVE"
        }
      },
      {
        "_index": "survey",
        "_id": "3",
        "_score": 1,
        "_source": {
          "question_C": {
            "form_answer_predicted": {
              "predicted_value": "NEGATIVE",
              "prediction_probability": 0.965237853665764,
              "model_id": "distilbert-base-uncased-finetuned-sst-2-english"
            },
            "question": "How would you describe our product(s)/service(s)?",
            "answer": "Very expensive"
          },
          "question_D": {
            "form_answer_predicted": {
              "predicted_value": "NEGATIVE",
              "prediction_probability": 0.9997315864531746,
              "model_id": "distilbert-base-uncased-finetuned-sst-2-english"
            },
            "question": "How satisfied are you with our company?",
            "answer": "Dissatisfied"
          },
          "question_A": {
            "form_answer_predicted": {
              "predicted_value": "NEGATIVE",
              "prediction_probability": 0.9997823345695842,
              "model_id": "distilbert-base-uncased-finetuned-sst-2-english"
            },
            "question": "How do you rate the customer service provided by the company?",
            "answer": "bad"
          },
          "question_B": {
            "form_answer_predicted": {
              "predicted_value": "NEGATIVE",
              "prediction_probability": 0.9964459731735253,
              "model_id": "distilbert-base-uncased-finetuned-sst-2-english"
            },
            "question": "The information about the product/service was passed on clearly and correctly",
            "answer": "no"
          },
          "user": "xpto",
          "user_satisfaction": "NEGATIVE"
        }
      }
    ]
  }
}

在进行搜索时,你会看到在每个问题中都生成了带有分类的字段,字段 form_answer_predicted。

          "question_B": {
            "form_answer_predicted": {
              "predicted_value": "NEGATIVE",
              "prediction_probability": 0.9964459731735253,
              "model_id": "distilbert-base-uncased-finetuned-sst-2-english"
            },

这个表示情绪识别的准确性。

另外,我们的通用分类字段 user_satisfaction 也已创建。 在下面的示例中,由于正面和负面预测的数量相同,我们的状态为“NEUTRAL”:

        "_source": {
          "question_C": {
            "form_answer_predicted": {
              "predicted_value": "POSITIVE",
              "prediction_probability": 0.9997634803424444,
              "model_id": "distilbert-base-uncased-finetuned-sst-2-english"
            },
            "question": "How would you describe our product(s)/service(s)?",
            "answer": "Useful"
          },
          "question_D": {
            "form_answer_predicted": {
              "predicted_value": "NEGATIVE",
              "prediction_probability": 0.9997315864531746,
              "model_id": "distilbert-base-uncased-finetuned-sst-2-english"
            },
            "question": "How satisfied are you with our company?",
            "answer": "Dissatisfied"
          },
          "question_A": {
            "form_answer_predicted": {
              "predicted_value": "POSITIVE",
              "prediction_probability": 0.9998161198125766,
              "model_id": "distilbert-base-uncased-finetuned-sst-2-english"
            },
            "question": "How do you rate the customer service provided by the company?",
            "answer": "good"
          },
          "question_B": {
            "form_answer_predicted": {
              "predicted_value": "NEGATIVE",
              "prediction_probability": 0.9964459731735253,
              "model_id": "distilbert-base-uncased-finetuned-sst-2-english"
            },
            "question": "The information about the product/service was passed on clearly and correctly",
            "answer": "no"
          },
          "user": "xpto",
          "user_satisfaction": "NEUTRAL"
        }
      }

好了,今天的文章就写到这里。希望你通过这个例子能对 Elastic Stack 所提供的 NLP 有更多的认识,并在你将来的应用中使用到。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/358293.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

【Linux 多线程同步】使用同步和互斥实现生产消费模型

目录 1.同步的接口 2.多线程但是按顺序来执行 3.生产消费模型 4.使用互斥加同步实现生产消费模型 &#xff08;采用环形队列&#xff09; 同步&#xff1a;在保证数据安全的前提下&#xff0c;让线程能够按照某种特定的顺序访问临界资源&#xff0c;从而有效避免饥饿问题 …

GraphTrip论文笔记【Information Fusion 92 (2023)】

Dual-grained human mobility learning for location-aware trip recommendation with spatial–temporal graph knowledge fusion 期刊&#xff1a;EI检索 Information Fusion 92 (2023) Challenges &#xff08;1&#xff09;异质交互信息的挖掘 POI位置信息、POI类别信息…

重新标记ImageNet:从全局标签到局部标签(附github代码及论文)

欢迎关注“计算机视觉研究院”计算机视觉研究院专栏作者&#xff1a;Edison_GImageNet可以说是最受欢迎的图像分类基准&#xff0c;但它也是一个具有显著噪声的标签。最近的研究表明&#xff0c;许多样本包含多个类&#xff0c;尽管被假定为单个标签基准。因此&#xff0c;他们…

【办公类-18-02】Python VScode 制作“照片整理.py”的exe文件(打包系列)

效果展示&#xff1a;背景需求&#xff1a;最近一年我都是机动班&#xff08;非固定班主任&#xff09;&#xff0c;所以拍的照片不多&#xff0c;只需要每月把手机里的照片用QQ的“我的文件助手”导出来&#xff0c;然后打开VScode&#xff0c;找到“20211020按日期批量整理文…

独居老人一键式报警器

盾王居家养老一键式报警系统&#xff0c;居家养老一键式报警设备 &#xff0c;一键通紧急呼救设备&#xff0c;一键通紧急呼救系统&#xff0c;一键通紧急呼救器 &#xff0c;一键通紧急呼救终端&#xff0c;一键通紧急呼救主机终端产品简介&#xff1a; 老人呼叫系统主要应用于…

java网络编程-nio学习:阻塞和非阻塞

一、阻塞 阻塞模式下&#xff0c;相关方法都会导致线程暂停 ServerSocketChannel.accept 会在没有连接建立时让线程暂停 SocketChannel.read 会在没有数据可读时让线程暂停 阻塞的表现其实就是线程暂停了&#xff0c;暂停期间不会占用 cpu&#xff0c;但线程相当于闲置 单线…

Learning C++ No.11【string类实现】

引言&#xff1a; 北京时间&#xff1a;2023/2/19/8:48&#xff0c;昨天更新了有关进程状态的博客&#xff0c;然后在休息的时候&#xff0c;打开了腾讯视屏&#xff0c;然后看到了了一个电视剧&#xff0c;导致上头&#xff0c;从晚上6点看到了10点&#xff0c;把我宝贵的博客…

vue(5)

文章目录1. 监测数据原理1.1 通过问题引出1.2 开始1.3 Vue.set() 方法1.4 vue 监视 数组1.5 小练习2. 收集表数据3. 过滤器4. 内置指令4.1 v-text4.2 v-html4.3 v-cloak4.4 v-once4.5 v-pre1. 监测数据原理 1.1 通过问题引出 1.2 开始 要想解决上面的这个问题 &#xff0c;需要…

python基于django幼儿园管理系统

目录 1 绪论 1 1.1课题背景 1 1.2课题研究现状 1 1.3初步设计方法与实施方案 2 1.4本文研究内容 2 2 系统开发环境 4 2.1 JAVA简介 4 2.2MyEclipse环境配置 4 2.3 B/S结构简介 4 2.4MySQL数据库 5 2.5 SPRINGBOOT框架 5 3 系统分析 6 3.1系统可行性分析 6 3.1.1经济可行性 6 3…

【2022.12.9】Lammps+Python 在计算g6(r)时遇到的问题

目录写在前面绘制g6( r )执行步骤【updated】如何检查图像的正确性&#xff1a;不是编程问题&#xff0c;而是数学问题的一个小bug废稿2则&#xff1a;写在前面 全部log&#xff1a; 【2022.11.16】LammpsPythonMATLAB在绘制维诺图时遇到的问题 绘制g6( r )执行步骤【updated…

Eureka原理浅析

文章目录1.简介2.组件2.1 Eureka Server2.1.1 主要功能2.1.2 自我保护机制2.1.3 数据同步方式2.1.4 Server的多级缓存和Client实例过期策略2.2 Eureka Client3.补充3.1 CAP偏重点3.2 功能扩展性3.3 工作流程1.简介 Eureka是Netflix开发的服务发现框架&#xff0c;本身是基于RE…

SegNeXt: 重新思考基于卷积注意力的语义分割

论文信息 论文名称&#xff1a;SegNeXt: Rethinking Convolutional Attention Design for Semantic Segmentation 项目GitHub&#xff1a; GitHub - Visual-Attention-Network/SegNeXt: Official Pytorch implementations for "SegNeXt: Rethinking Convolutional Atten…

ESP-C3入门11. 创建最基本的HTTP请求

ESP-C3入门11. 创建最基本的HTTP请求一、menuconfig配置二、配置 CMakeLists1. 设置项目的额外组件目录2. 设置头文件搜索目录三、在 ESP32 上执行 HTTP 请求的基本步骤1. 创建 TCP 连接2. 设置 HTTP 请求3. 发送 HTTP 请求4. 接收 HTTP 响应5. 处理 HTTP 响应6. 关闭 TCP 连接…

35岁以上的大龄测试员们,后来都干什么去了?

为什么软件测试行业看不见白发苍苍的软件测试员?大龄测试员都去哪里了?各个公司会辞退大龄测试员吗? 如果一位 50 多岁的测试员申请 20 多岁或 30 多岁的职位&#xff0c;有多少公司会雇用他们呢?关于这个问题&#xff0c;有很多流言传说&#xff0c;也有一些残酷的现实。…

努力优化和改造不好的环境,去设计新的、积极的、适合自己的环境

你知道环境对你的影响有多大吗&#xff1f;自己的的社交圈也是一个环境如果你待在一个只知道吃喝玩乐&#xff0c;不思进取&#xff0c;天天玩手机、打游戏的圈子里那你很大程度也会被影响&#xff0c;因为你不跟他们一起你就融入不进去&#xff0c;就会被孤立&#xff0c;很多…

优秀蓝牙耳机推荐,热销不错的四款蓝牙耳机推荐

蓝牙耳机作为目前最流行的数码产品&#xff0c;受到很多人追捧&#xff0c;蓝牙耳机摆脱了有线蓝牙耳机的束缚&#xff0c;能够更好听歌打游戏&#xff0c;随时取用&#xff0c;更为便利&#xff0c;当然&#xff0c;随着耳机的大幅度创新&#xff0c;也导致很多人在选购耳机的…

内网渗透(四十三)之横向移动篇-SMB远程执行命令横向移动

系列文章第一章节之基础知识篇 内网渗透(一)之基础知识-内网渗透介绍和概述 内网渗透(二)之基础知识-工作组介绍 内网渗透(三)之基础知识-域环境的介绍和优点 内网渗透(四)之基础知识-搭建域环境 内网渗透(五)之基础知识-Active Directory活动目录介绍和使用 内网渗透(六)之基…

前端性能优化的一些技巧(90% chatGpt生成)

终于弄好了chatGpt的账号&#xff0c;赶紧来体验一波。先来一波结论&#xff0c;这篇文章的主要内容来源&#xff0c;90%是用chatGpt生成的。先上chatGpt的生成的结果&#xff1a;作为一名懒惰的程序员&#xff0c;chatGpt会帮助我变得更懒...&#xff0c;好了下面开始文章的正…

GEE学习笔记 六十八:【GEE之Python版教程二】配置Python开发环境

这一篇内容主要讲解两部分内容&#xff0c;第一部分是本地python开发环境的配置&#xff0c;第二部分是GEE的python开发环境配置。我这里做的所有的操作都是在我的Mac电脑上做的&#xff0c;Windows上操作类似&#xff0c;如果有不清楚的可以自行搜索相关操作步骤。 第一部分&…

pytorch零基础实现语义分割项目(四)——模型训练与预测

模型训练与预测项目列表前言损失函数one_hotDice LossFocal Loss模型参数与训练预测项目列表 语义分割项目&#xff08;一&#xff09;——数据概况及预处理 语义分割项目&#xff08;二&#xff09;——标签转换与数据加载 语义分割项目&#xff08;三&#xff09;——语义…