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

【Elasticsearch】-图片向量化存储

需要结合深度学习模型

1、pom依赖

注意结尾的webp-imageio 包,用于解决ImageIO.read读取部分图片返回为null的问题

<dependency><groupId>org.openpnp</groupId><artifactId>opencv</artifactId><version>4.7.0-0</version></dependency><dependency><groupId>com.microsoft.onnxruntime</groupId><artifactId>onnxruntime</artifactId><version>1.17.1</version></dependency><!-- 服务器端推理引擎 --><dependency><groupId>ai.djl</groupId><artifactId>api</artifactId><version>${djl.version}</version></dependency><dependency><groupId>ai.djl</groupId><artifactId>basicdataset</artifactId><version>${djl.version}</version></dependency><dependency><groupId>ai.djl</groupId><artifactId>model-zoo</artifactId><version>${djl.version}</version></dependency><!-- Pytorch --><dependency><groupId>ai.djl.pytorch</groupId><artifactId>pytorch-engine</artifactId><version>${djl.version}</version></dependency><dependency><groupId>ai.djl.pytorch</groupId><artifactId>pytorch-model-zoo</artifactId><version>${djl.version}</version></dependency><!-- ONNX --><dependency><groupId>ai.djl.onnxruntime</groupId><artifactId>onnxruntime-engine</artifactId><version>${djl.version}</version></dependency><!-- 解决ImageIO.read 读取为null --><dependency><groupId>org.sejda.imageio</groupId><artifactId>webp-imageio</artifactId><version>0.1.6</version></dependency>

2、加载模型

注意提前设置环境变量,pytorch依赖环境dll文件,如果不存在,则默认下载

System.setProperty("ENGINE_CACHE_DIR", modelPath);

import ai.djl.Device;
import ai.djl.modality.cv.Image;
import ai.djl.repository.zoo.Criteria;
import ai.djl.training.util.ProgressBar;
import ai.djl.translate.Translator;public Criteria<Image, T> criteria() {Translator<Image, T> translator = getTranslator(arguments);try {JarFileUtils.copyFileFromJar("/onnx/models/" + modelName, PathConstants.ONNX, null, false, true);} catch (IOException e) {throw new RuntimeException(e);}
//        String model_path = PathConstants.TEMP_DIR + PathConstants.ONNX + "/" + modelName;String modelPath = PathConstants.TEMP_DIR + File.separator+PathConstants.ONNX_NAME+ File.separator + modelName;log.info("路径修改前:{}",modelPath);modelPath= DjlHandlerUtil.getFixedModelPath(modelPath);log.info("路径修改后:{}",modelPath);Criteria<Image, T> criteria =Criteria.builder().setTypes(Image.class, getClassOfT()).optModelUrls(modelPath).optTranslator(translator).optDevice(Device.cpu()).optEngine(getEngine()) // Use PyTorch engine.optProgress(new ProgressBar()).build();return criteria;}protected Translator<Image, float[]> getTranslator(Map<String, Object> arguments) {BaseImageTranslator.BaseBuilder<?> builder=new BaseImageTranslator.BaseBuilder<BaseImageTranslator.BaseBuilder>() {@Overrideprotected BaseImageTranslator.BaseBuilder self() {return this;}};return new BaseImageTranslator<float[]>(builder) {@Overridepublic float[] processOutput(TranslatorContext translatorContext, NDList ndList) throws Exception {return ndList.get(0).toFloatArray();}};}

3、FaceFeatureTranslator

import ai.djl.modality.cv.Image;
import ai.djl.modality.cv.transform.Normalize;
import ai.djl.modality.cv.transform.ToTensor;
import ai.djl.ndarray.NDArray;
import ai.djl.ndarray.NDList;
import ai.djl.translate.Batchifier;
import ai.djl.translate.Pipeline;
import ai.djl.translate.Translator;
import ai.djl.translate.TranslatorContext;/*** @author gc.x* @date 2022-04*/
public final class FaceFeatureTranslator implements Translator<Image, float[]> {public FaceFeatureTranslator() {}@Overridepublic NDList processInput(TranslatorContext ctx, Image input) {NDArray array = input.toNDArray(ctx.getNDManager(), Image.Flag.COLOR);Pipeline pipeline = new Pipeline();pipeline// .add(new Resize(160)).add(new ToTensor()).add(new Normalize(new float[]{127.5f / 255.0f, 127.5f / 255.0f, 127.5f / 255.0f},new float[]{128.0f / 255.0f, 128.0f / 255.0f, 128.0f / 255.0f}));return pipeline.transform(new NDList(array));}@Overridepublic float[] processOutput(TranslatorContext ctx, NDList list) {NDList result = new NDList();long numOutputs = list.singletonOrThrow().getShape().get(0);for (int i = 0; i < numOutputs; i++) {result.add(list.singletonOrThrow().get(i));}float[][] embeddings = result.stream().map(NDArray::toFloatArray).toArray(float[][]::new);float[] feature = new float[embeddings.length];for (int i = 0; i < embeddings.length; i++) {feature[i] = embeddings[i][0];}return feature;}@Overridepublic Batchifier getBatchifier() {return Batchifier.STACK;}
}

4、BaseImageTranslator


import ai.djl.Model;
import ai.djl.modality.cv.Image;
import ai.djl.modality.cv.transform.CenterCrop;
import ai.djl.modality.cv.transform.Normalize;
import ai.djl.modality.cv.transform.Resize;
import ai.djl.modality.cv.transform.ToTensor;
import ai.djl.modality.cv.util.NDImageUtils;
import ai.djl.ndarray.NDArray;
import ai.djl.ndarray.NDList;
import ai.djl.translate.*;
import ai.djl.util.Utils;import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Arrays;
import java.util.List;
import java.util.Map;public abstract class BaseImageTranslator<T> implements Translator<Image, T> {private static final float[] MEAN = {0.485f, 0.456f, 0.406f};private static final float[] STD = {0.229f, 0.224f, 0.225f};private Image.Flag flag;private Pipeline pipeline;private Batchifier batchifier;/*** Constructs an ImageTranslator with the provided builder.** @param builder the data to build with*/public BaseImageTranslator(BaseBuilder<?> builder) {flag = builder.flag;pipeline = builder.pipeline;batchifier = builder.batchifier;}/** {@inheritDoc} */@Overridepublic Batchifier getBatchifier() {return batchifier;}/*** Processes the {@link Image} input and converts it to NDList.** @param ctx the toolkit that helps create the input NDArray* @param input the {@link Image} input* @return a {@link NDList}*/@Overridepublic NDList processInput(TranslatorContext ctx, Image input) {NDArray array = input.toNDArray(ctx.getNDManager(), flag);array = NDImageUtils.resize(array, 640, 640);array = array.transpose(2, 0, 1); // HWC -> CHW RGB -> BGR
//        array = array.expandDims(0);array = array.div(255f);return new NDList(array);
//        return pipeline.transform(new NDList(array));}protected static String getStringValue(Map<String, ?> arguments, String key, String def) {Object value = arguments.get(key);if (value == null) {return def;}return value.toString();}protected static int getIntValue(Map<String, ?> arguments, String key, int def) {Object value = arguments.get(key);if (value == null) {return def;}return (int) Double.parseDouble(value.toString());}protected static float getFloatValue(Map<String, ?> arguments, String key, float def) {Object value = arguments.get(key);if (value == null) {return def;}return (float) Double.parseDouble(value.toString());}protected static boolean getBooleanValue(Map<String, ?> arguments, String key, boolean def) {Object value = arguments.get(key);if (value == null) {return def;}return Boolean.parseBoolean(value.toString());}/*** A builder to extend for all classes extending the {@link BaseImageTranslator}.** @param <T> the concrete builder type*/@SuppressWarnings("rawtypes")public abstract static class BaseBuilder<T extends BaseBuilder> {protected int width = 224;protected int height = 224;protected Image.Flag flag = Image.Flag.COLOR;protected Pipeline pipeline;protected Batchifier batchifier = Batchifier.STACK;/*** Sets the optional {@link Image.Flag} (default is {@link* Image.Flag#COLOR}).** @param flag the color mode for the images* @return this builder*/public T optFlag(Image.Flag flag) {this.flag = flag;return self();}/*** Sets the {@link Pipeline} to use for pre-processing the image.** @param pipeline the pre-processing pipeline* @return this builder*/public T setPipeline(Pipeline pipeline) {this.pipeline = pipeline;return self();}/*** Adds the {@link Transform} to the {@link Pipeline} use for pre-processing the image.** @param transform the {@link Transform} to be added* @return this builder*/public T addTransform(Transform transform) {if (pipeline == null) {pipeline = new Pipeline();}pipeline.add(transform);return self();}/*** Sets the {@link Batchifier} for the {@link Translator}.** @param batchifier the {@link Batchifier} to be set* @return this builder*/public T optBatchifier(Batchifier batchifier) {this.batchifier = batchifier;return self();}protected abstract T self();protected void validate() {if (pipeline == null) {throw new IllegalArgumentException("pipeline is required.");}}protected void configPreProcess(Map<String, ?> arguments) {if (pipeline == null) {pipeline = new Pipeline();}width = getIntValue(arguments, "width", 224);height = getIntValue(arguments, "height", 224);if (arguments.containsKey("flag")) {flag = Image.Flag.valueOf(arguments.get("flag").toString());}if (getBooleanValue(arguments, "centerCrop", false)) {addTransform(new CenterCrop());}if (getBooleanValue(arguments, "resize", false)) {addTransform(new Resize(width, height));}if (getBooleanValue(arguments, "toTensor", true)) {addTransform(new ToTensor());}String normalize = getStringValue(arguments, "normalize", "false");if ("true".equals(normalize)) {addTransform(new Normalize(MEAN, STD));} else if (!"false".equals(normalize)) {String[] tokens = normalize.split("\\s*,\\s*");if (tokens.length != 6) {throw new IllegalArgumentException("Invalid normalize value: " + normalize);}float[] mean = {Float.parseFloat(tokens[0]),Float.parseFloat(tokens[1]),Float.parseFloat(tokens[2])};float[] std = {Float.parseFloat(tokens[3]),Float.parseFloat(tokens[4]),Float.parseFloat(tokens[5])};addTransform(new Normalize(mean, std));}String range = (String) arguments.get("range");if ("0,1".equals(range)) {addTransform(a -> a.div(255f));} else if ("-1,1".equals(range)) {addTransform(a -> a.div(128f).sub(1));}if (arguments.containsKey("batchifier")) {batchifier = Batchifier.fromString((String) arguments.get("batchifier"));}}protected void configPostProcess(Map<String, ?> arguments) {}}/** A Builder to construct a {@code ImageClassificationTranslator}. */@SuppressWarnings("rawtypes")public abstract static class ClassificationBuilder<T extends BaseBuilder>extends BaseBuilder<T> {protected SynsetLoader synsetLoader;/*** Sets the name of the synset file listing the potential classes for an image.** @param synsetArtifactName a file listing the potential classes for an image* @return the builder*/public T optSynsetArtifactName(String synsetArtifactName) {synsetLoader = new SynsetLoader(synsetArtifactName);return self();}/*** Sets the URL of the synset file.** @param synsetUrl the URL of the synset file* @return the builder*/public T optSynsetUrl(String synsetUrl) {try {this.synsetLoader = new SynsetLoader(new URL(synsetUrl));} catch (MalformedURLException e) {throw new IllegalArgumentException("Invalid synsetUrl: " + synsetUrl, e);}return self();}/*** Sets the potential classes for an image.** @param synset the potential classes for an image* @return the builder*/public T optSynset(List<String> synset) {synsetLoader = new SynsetLoader(synset);return self();}/** {@inheritDoc} */@Overrideprotected void validate() {super.validate();if (synsetLoader == null) {synsetLoader = new SynsetLoader("synset.txt");}}/** {@inheritDoc} */@Overrideprotected void configPostProcess(Map<String, ?> arguments) {String synset = (String) arguments.get("synset");if (synset != null) {optSynset(Arrays.asList(synset.split(",")));}String synsetUrl = (String) arguments.get("synsetUrl");if (synsetUrl != null) {optSynsetUrl(synsetUrl);}String synsetFileName = (String) arguments.get("synsetFileName");if (synsetFileName != null) {optSynsetArtifactName(synsetFileName);}}}protected static final class SynsetLoader {private String synsetFileName;private URL synsetUrl;private List<String> synset;public SynsetLoader(List<String> synset) {this.synset = synset;}public SynsetLoader(URL synsetUrl) {this.synsetUrl = synsetUrl;}public SynsetLoader(String synsetFileName) {this.synsetFileName = synsetFileName;}public List<String> load(Model model) throws IOException {if (synset != null) {return synset;} else if (synsetUrl != null) {try (InputStream is = synsetUrl.openStream()) {return Utils.readLines(is);}}return model.getArtifact(synsetFileName, Utils::readLines);}}
}

5、添加到ES

float[] feature;
// 构建文档Map<String, Object> dataMap = req.getDataMap();// 内置参数dataMap.put("_es_doc_type", "IMAGE");dataMap.put("vector", feature);IndexRequest<Map> request = IndexRequest.of(i -> i.index(req.getIndexLib()).id(req.getDocId()).document(dataMap));IndexResponse response = esClient.index(request);boolean flag = response.result() == Result.Created;log.info("添加文档id={},结果={}", req.getDocId(), flag);

6、pytorch环境依赖

cpu/linux-x86_64/native/lib/libc10.so.gz
cpu/linux-x86_64/native/lib/libtorch_cpu.so.gz
cpu/linux-x86_64/native/lib/libtorch.so.gz
cpu/linux-x86_64/native/lib/libgomp-52f2fd74.so.1.gz
cpu/osx-aarch64/native/lib/libtorch_cpu.dylib.gz
cpu/osx-aarch64/native/lib/libtorch.dylib.gz
cpu/osx-aarch64/native/lib/libc10.dylib.gz
cpu/osx-x86_64/native/lib/libtorch_cpu.dylib.gz
cpu/osx-x86_64/native/lib/libiomp5.dylib.gz
cpu/osx-x86_64/native/lib/libtorch.dylib.gz
cpu/osx-x86_64/native/lib/libc10.dylib.gz
cpu/win-x86_64/native/lib/torch.dll.gz
cpu/win-x86_64/native/lib/uv.dll.gz
cpu/win-x86_64/native/lib/torch_cpu.dll.gz
cpu/win-x86_64/native/lib/c10.dll.gz
cpu/win-x86_64/native/lib/fbgemm.dll.gz
cpu/win-x86_64/native/lib/libiomp5md.dll.gz
cpu/win-x86_64/native/lib/asmjit.dll.gz
cpu/win-x86_64/native/lib/libiompstubs5md.dll.gz
cpu-precxx11/linux-aarch64/native/lib/libc10.so.gz
cpu-precxx11/linux-aarch64/native/lib/libtorch_cpu.so.gz
cpu-precxx11/linux-aarch64/native/lib/libarm_compute-973e5a6b.so.gz
cpu-precxx11/linux-aarch64/native/lib/libopenblasp-r0-56e95da7.3.24.so.gz
cpu-precxx11/linux-aarch64/native/lib/libtorch.so.gz
cpu-precxx11/linux-aarch64/native/lib/libarm_compute_graph-6990f339.so.gz
cpu-precxx11/linux-aarch64/native/lib/libstdc%2B%2B.so.6.gz
cpu-precxx11/linux-aarch64/native/lib/libarm_compute_core-0793f69d.so.gz
cpu-precxx11/linux-aarch64/native/lib/libgfortran-b6d57c85.so.5.0.0.gz
cpu-precxx11/linux-aarch64/native/lib/libgomp-6e1a1d1b.so.1.0.0.gz
cpu-precxx11/linux-x86_64/native/lib/libgomp-a34b3233.so.1.gz
cpu-precxx11/linux-x86_64/native/lib/libc10.so.gz
cpu-precxx11/linux-x86_64/native/lib/libtorch_cpu.so.gz
cpu-precxx11/linux-x86_64/native/lib/libtorch.so.gz
cpu-precxx11/linux-x86_64/native/lib/libstdc%2B%2B.so.6.gz
cu121/linux-x86_64/native/lib/libc10_cuda.so.gz
cu121/linux-x86_64/native/lib/libcudnn.so.8.gz
cu121/linux-x86_64/native/lib/libnvfuser_codegen.so.gz
cu121/linux-x86_64/native/lib/libc10.so.gz
cu121/linux-x86_64/native/lib/libtorch_cpu.so.gz
cu121/linux-x86_64/native/lib/libcaffe2_nvrtc.so.gz
cu121/linux-x86_64/native/lib/libcudnn_adv_infer.so.8.gz
cu121/linux-x86_64/native/lib/libcudnn_cnn_train.so.8.gz
cu121/linux-x86_64/native/lib/libcudnn_ops_infer.so.8.gz
cu121/linux-x86_64/native/lib/libnvrtc-builtins-6c5639ce.so.12.1.gz
cu121/linux-x86_64/native/lib/libnvrtc-b51b459d.so.12.gz
cu121/linux-x86_64/native/lib/libtorch.so.gz
cu121/linux-x86_64/native/lib/libtorch_cuda_linalg.so.gz
cu121/linux-x86_64/native/lib/libcublas-37d11411.so.12.gz
cu121/linux-x86_64/native/lib/libtorch_cuda.so.gz
cu121/linux-x86_64/native/lib/libcudnn_adv_train.so.8.gz
cu121/linux-x86_64/native/lib/libcublasLt-f97bfc2c.so.12.gz
cu121/linux-x86_64/native/lib/libnvToolsExt-847d78f2.so.1.gz
cu121/linux-x86_64/native/lib/libcudnn_ops_train.so.8.gz
cu121/linux-x86_64/native/lib/libcudnn_cnn_infer.so.8.gz
cu121/linux-x86_64/native/lib/libgomp-52f2fd74.so.1.gz
cu121/linux-x86_64/native/lib/libcudart-9335f6a2.so.12.gz
cu121/win-x86_64/native/lib/zlibwapi.dll.gz
cu121/win-x86_64/native/lib/cudnn_ops_train64_8.dll.gz
cu121/win-x86_64/native/lib/torch.dll.gz
cu121/win-x86_64/native/lib/nvrtc-builtins64_121.dll.gz
cu121/win-x86_64/native/lib/cufftw64_11.dll.gz
cu121/win-x86_64/native/lib/cudnn_adv_infer64_8.dll.gz
cu121/win-x86_64/native/lib/nvrtc64_120_0.dll.gz
cu121/win-x86_64/native/lib/cusolverMg64_11.dll.gz
cu121/win-x86_64/native/lib/torch_cuda.dll.gz
cu121/win-x86_64/native/lib/cufft64_11.dll.gz
cu121/win-x86_64/native/lib/cublas64_12.dll.gz
cu121/win-x86_64/native/lib/cudnn64_8.dll.gz
cu121/win-x86_64/native/lib/uv.dll.gz
cu121/win-x86_64/native/lib/cudnn_cnn_train64_8.dll.gz
cu121/win-x86_64/native/lib/caffe2_nvrtc.dll.gz
cu121/win-x86_64/native/lib/torch_cpu.dll.gz
cu121/win-x86_64/native/lib/c10.dll.gz
cu121/win-x86_64/native/lib/cudnn_cnn_infer64_8.dll.gz
cu121/win-x86_64/native/lib/c10_cuda.dll.gz
cu121/win-x86_64/native/lib/cudart64_12.dll.gz
cu121/win-x86_64/native/lib/nvfuser_codegen.dll.gz
cu121/win-x86_64/native/lib/fbgemm.dll.gz
cu121/win-x86_64/native/lib/curand64_10.dll.gz
cu121/win-x86_64/native/lib/libiomp5md.dll.gz
cu121/win-x86_64/native/lib/cusolver64_11.dll.gz
cu121/win-x86_64/native/lib/cudnn_adv_train64_8.dll.gz
cu121/win-x86_64/native/lib/cublasLt64_12.dll.gz
cu121/win-x86_64/native/lib/nvToolsExt64_1.dll.gz
cu121/win-x86_64/native/lib/nvJitLink_120_0.dll.gz
cu121/win-x86_64/native/lib/cusparse64_12.dll.gz
cu121/win-x86_64/native/lib/asmjit.dll.gz
cu121/win-x86_64/native/lib/cudnn_ops_infer64_8.dll.gz
cu121/win-x86_64/native/lib/libiompstubs5md.dll.gz
cu121/win-x86_64/native/lib/cupti64_2023.1.1.dll.gz
cu121-precxx11/linux-x86_64/native/lib/libgomp-a34b3233.so.1.gz
cu121-precxx11/linux-x86_64/native/lib/libc10_cuda.so.gz
cu121-precxx11/linux-x86_64/native/lib/libcudnn.so.8.gz
cu121-precxx11/linux-x86_64/native/lib/libnvfuser_codegen.so.gz
cu121-precxx11/linux-x86_64/native/lib/libc10.so.gz
cu121-precxx11/linux-x86_64/native/lib/libtorch_cpu.so.gz
cu121-precxx11/linux-x86_64/native/lib/libcaffe2_nvrtc.so.gz
cu121-precxx11/linux-x86_64/native/lib/libcudnn_adv_infer.so.8.gz
cu121-precxx11/linux-x86_64/native/lib/libcudnn_cnn_train.so.8.gz
cu121-precxx11/linux-x86_64/native/lib/libcudnn_ops_infer.so.8.gz
cu121-precxx11/linux-x86_64/native/lib/libnvrtc-builtins-6c5639ce.so.12.1.gz
cu121-precxx11/linux-x86_64/native/lib/libnvrtc-b51b459d.so.12.gz
cu121-precxx11/linux-x86_64/native/lib/libtorch.so.gz
cu121-precxx11/linux-x86_64/native/lib/libtorch_cuda_linalg.so.gz
cu121-precxx11/linux-x86_64/native/lib/libcublas-37d11411.so.12.gz
cu121-precxx11/linux-x86_64/native/lib/libtorch_cuda.so.gz
cu121-precxx11/linux-x86_64/native/lib/libstdc%2B%2B.so.6.gz
cu121-precxx11/linux-x86_64/native/lib/libcudnn_adv_train.so.8.gz
cu121-precxx11/linux-x86_64/native/lib/libcublasLt-f97bfc2c.so.12.gz
cu121-precxx11/linux-x86_64/native/lib/libnvToolsExt-847d78f2.so.1.gz
cu121-precxx11/linux-x86_64/native/lib/libcudnn_ops_train.so.8.gz
cu121-precxx11/linux-x86_64/native/lib/libcudnn_cnn_infer.so.8.gz
cu121-precxx11/linux-x86_64/native/lib/libcudart-9335f6a2.so.12.gz
 

相关文章:

【Elasticsearch】-图片向量化存储

需要结合深度学习模型 1、pom依赖 注意结尾的webp-imageio 包&#xff0c;用于解决ImageIO.read读取部分图片返回为null的问题 <dependency><groupId>org.openpnp</groupId><artifactId>opencv</artifactId><version>4.7.0-0</versio…...

二叉树(一)高度与深度

高度&#xff1a;从最底层往上数&#xff08;后序遍历&#xff0c;左右根&#xff09;&#xff0c;更简单&#xff08;递归&#xff09; 深度&#xff1a;从上往下数直到有叶子&#xff08;前序遍历&#xff0c;根左右&#xff09;&#xff0c;较复杂 高度是最大深度 一、求…...

梧桐数据库(WuTongDB):MySQL 优化器简介

MySQL 优化器是数据库管理系统中的一个重要组件&#xff0c;用于生成并选择最优的查询执行计划&#xff0c;以提高 SQL 查询的执行效率。它采用了基于代价的优化方法&#xff08;Cost-Based Optimizer, CBO&#xff09;&#xff0c;通过评估不同查询执行方案的代价&#xff0c;…...

交通运输部力推高速公路监测,做好结构安全预警,保护人民安全

在快速发展的交通网络中&#xff0c;高速公路作为经济命脉与生命通道&#xff0c;其结构安全直接关系到每一位行路者的生命财产安全。为此&#xff0c;广东省交通运输厅正式发布《关于积极申报高速公路监测预警应用示范揭榜的通知》&#xff0c;旨在通过技术创新与应用示范&…...

基于PHP+MySQL组合开发的在线客服源码系统 聊天记录实时保存 带完整的安装代码包以及搭建部署教程

系统概述 随着互联网技术的飞速发展&#xff0c;企业与客户之间的沟通方式日益多样化&#xff0c;在线客服系统作为连接企业与客户的桥梁&#xff0c;其重要性不言而喻。然而&#xff0c;市场上现有的在线客服系统往往存在成本高、定制性差、维护复杂等问题。针对这些痛点&…...

NEXT.js 创建postgres数据库-关联github项目-连接数据库-在项目初始化数据库的数据

github创建项目仓库创建Vercel账号选择hobby连接github仓库install - deploy创建postgres数据库&#xff08;等待deploy完成&#xff09; Continue to DashboardStorage&#xff08;头部nav哪里&#xff09;create Postgresconnect连接完后&#xff0c;切换到.env.local&#x…...

Matlab如何配置小波工具(Wavelet Toolbox)

1、发现问题 因为实验要使用小波工具函数&#xff0c;运行时报错如下&#xff1a; 查看对应文件夹发现没有小波工具&#xff08;也可在控制台输入ver&#xff09;&#xff0c;检查是否有该工具&#xff0c;输入后回车返回如下&#xff1a; 2、下载工具包 没有这个工具就要去下…...

FTP、SFTP安装,整合Springboot教程

文章目录 前言一、FTP、SFTP是什么&#xff1f;1.FTP2.SFTP 二、安装FTP1.安装vsftp服务2.启动服务并设置开机自启动3.开放防火墙和SELinux4.创建用户和FTP目录4.修改vsftpd.conf文件5.启动FTP服务6.问题 二、安装SFTP1、 创建用户2、配置ssh和权限3、建立目录并赋予权限4、启动…...

24年蓝桥杯及攻防世界赛题-MISC-3

21 reverseMe 复制图片&#xff0c;在线ocr识别&#xff0c;https://ocr.wdku.net/&#xff0c;都不费眼睛。 22 misc_pic_again ┌──(holyeyes㉿kali2023)-[~/Misc/tool-misc/zsteg] └─$ zsteg misc_pic_again.png imagedata … text: “$$KaTeX parse error: Undefined…...

阿里云容器服务Kubernetes部署新服务

这里部署的是前端项目 1.登录控制台-选择集群 2.选择无状态-命名空间-使用镜像创建 3.填写相关信息 应用基本信息&#xff1a; 容器配置&#xff1a; 高级配置&#xff1a; 创建成功后就可以通过30006端口访问项目了...

记录生产环境,通过域名访问的图片展示不全,通过ip+端口的方式访问图片是完整的

原因&#xff1a;部署nginx的服务器硬盘满了 排查发现nginx日志文件占用了大量硬盘 解决方案&#xff1a; 删除该文件&#xff0c;重启nginx服务&#xff0c;问题解决。...

网络安全实训八(y0usef靶机渗透实例)

1 信息收集 1.1 扫描靶机IP 1.2 收集靶机的端口开放情况 1.3 探测靶机网站的目录 1.4 发现可疑网站 1.5 打开可疑网站 2 渗透 2.1 使用BP获取请求 2.2 使用工具403bypasser.py探测可疑网页 2.3 显示可以添加头信息X-Forwarded-For:localhost来访问 2.4 添加之后转发&#xff…...

QT信号槽原理是什么,如何去使用它?

QT的信号槽&#xff08;Signals and Slots&#xff09;机制是QT框架的核心特性之一&#xff0c;它提供了一种对象间通信的方式&#xff0c;使得QT的部件可以在不知道彼此详细实现的情况下相互通信。这种机制在图形用户界面编程中尤为重要&#xff0c;因为它有助于降低对象间的耦…...

mybatisplus介绍以及使用(上)

目录 一、概念 1、什么是mybatisplus 2、为什么要使用mybatisplus 二、mybatisplus的使用 1、安装 2、常用注解 3、条件构造器 一、概念 1、什么是mybatisplus MyBatis-Plus&#xff08;简称MP&#xff09;是一个基于MyBatis的增强框架&#xff0c;旨在简化开发、提高…...

maxwell 输出消息到 redis

文章目录 1、maxwell 输出消息到 redis1.1、启动一个Maxwell容器&#xff0c;它会连接到指定的MySQL数据库&#xff0c;捕获变更事件&#xff0c;并将这些事件以Redis发布/订阅的形式发送到指定的Redis服务器1.2、在已运行的 Redis 容器中执行 Redis 命令行界面&#xff08;CLI…...

infoNCE损失和互信息的关系

文章目录 InfoNCE 损失与互信息的关系推导将相似度 sim ( q , x ) \text{sim}(q, x) sim(q,x) 看作是负的能量函数infoNCE和互信息的分母不同 InfoNCE 损失与互信息的关系推导 为了理解 InfoNCE 损失与互信息的关系&#xff0c;首先我们回顾两个公式的基本形式&#xff1a; 互…...

Java学习路线指南

目录 前言1. Java基础知识1.1 面向对象编程思想1.2 Java平台与JVM1.3 Java语言的核心概念 2. Java语法与基础实践2.1 数据类型与变量2.2 控制结构2.3 方法与函数2.4 数据结构与集合框架 3. Java进阶知识3.1 异步编程与多线程3.2 JVM调优与垃圾回收机制3.3 设计模式 4. 实践与项…...

在SpringCloud中实现服务间链路追踪

在微服务架构中&#xff0c;由于系统的复杂性和多样性&#xff0c;往往会涉及到多个服务之间的调用。当一个请求经过多个服务时&#xff0c;如果出现问题&#xff0c;我们希望能够快速定位问题所在。这就需要引入链路追踪机制&#xff0c;帮助我们定位问题。 Spring Cloud为我们…...

[数据集][目标检测]红外微小目标无人机直升机飞机飞鸟检测数据集VOC+YOLO格式7559张4类别

数据集格式&#xff1a;Pascal VOC格式YOLO格式(不包含分割路径的txt文件&#xff0c;仅仅包含jpg图片以及对应的VOC格式xml文件和yolo格式txt文件) 图片数量(jpg文件个数)&#xff1a;7559 标注数量(xml文件个数)&#xff1a;7559 标注数量(txt文件个数)&#xff1a;7559 标注…...

TS Vue项目中使用TypeScript

模块系统与命名空间 概念 模块化开发是目前最流行的组织代码方式&#xff0c;可以有效的解决代码之间的冲突与代码之间的依赖关系&#xff0c;模块系统一般视为“外部模块”&#xff0c;而命名空间一般视为“内部模块” 模块系统 TS中的模块化开发跟ES6中的模块化开发并没有…...

无机布防火卷帘门价格怎么算?按尺寸定制,按需报价

无机布防火卷帘门作为建筑防火分区的核心设备&#xff0c;价格一直是工程采购的关注重点。很多用户在询价时&#xff0c;会发现不同厂家的报价差异较大&#xff0c;这是因为无机布防火卷帘门的价格并非按统一单价计算&#xff0c;而是完全根据项目的实际需求定制化核算。 &…...

Redis沙盒体验:在浏览器中零门槛掌握NoSQL核心技能

Redis沙盒体验&#xff1a;在浏览器中零门槛掌握NoSQL核心技能 【免费下载链接】try.redis A demonstration of the Redis database. 项目地址: https://gitcode.com/gh_mirrors/tr/try.redis 当你第一次听说Redis时&#xff0c;是否被那些晦涩的技术术语吓退&#xff1…...

ARMv8 HFGITR_EL2寄存器解析与虚拟化指令陷阱控制

1. AArch64 HFGITR_EL2寄存器架构解析HFGITR_EL2&#xff08;Hypervisor Fine-Grained Instruction Trap Register&#xff09;是ARMv8架构中专门用于指令级陷阱控制的系统寄存器&#xff0c;属于虚拟化扩展的重要组成部分。这个64位寄存器通过位映射机制实现对特定AArch64指令…...

举一个具体例子说明为什么索引不是越多越好,举具体字段

文章目录1. 核心舞台&#xff1a;笔记表 (t_note) 结构设计&#x1f6a8; 错误的操作&#xff1a;2. 结合具体字段&#xff0c;拆解三大翻车现场现场一&#xff1a;给 view_count&#xff08;浏览量&#xff09;加索引 —— 导致写放大&#xff0c;拖垮数据库现场二&#xff1a…...

BiliBiliCCSubtitle终极指南:5个实战技巧高效下载B站字幕

BiliBiliCCSubtitle终极指南&#xff1a;5个实战技巧高效下载B站字幕 【免费下载链接】BiliBiliCCSubtitle 一个用于下载B站(哔哩哔哩)CC字幕及转换的工具; 项目地址: https://gitcode.com/gh_mirrors/bi/BiliBiliCCSubtitle 还在为无法保存B站视频字幕而烦恼&#xff1…...

Java网络编程基础分享

在学习 Java 的过程中&#xff0c;网络编程是非常重要的一环。无论是后端开发、分布式系统、即时通讯、文件传输&#xff0c;还是游戏服务、物联网设备&#xff0c;都离不开网络通信一、计算机网络基础1.1 什么是计算机网络把不同地理位置、具有独立功能的计算机&#xff0c;通…...

Python-for-Android 完整指南:5分钟将Python应用打包为Android APK

Python-for-Android 完整指南&#xff1a;5分钟将Python应用打包为Android APK 【免费下载链接】python-for-android Turn your Python application into an Android APK 项目地址: https://gitcode.com/gh_mirrors/py/python-for-android Python-for-Android&#xff0…...

Win11Debloat:Windows系统精简与隐私保护的专业解决方案

Win11Debloat&#xff1a;Windows系统精简与隐私保护的专业解决方案 【免费下载链接】Win11Debloat A simple, lightweight PowerShell script that allows you to remove pre-installed apps, disable telemetry, as well as perform various other changes to declutter and …...

别只盯着主控芯片!拆解STM32最小系统板:电源、时钟、复位三大支柱电路深度解析

STM32最小系统板设计进阶&#xff1a;电源、时钟与复位电路的工程实践 在嵌入式系统开发中&#xff0c;我们常常将注意力集中在主控芯片的功能实现上&#xff0c;却忽略了支撑系统稳定运行的三大基础电路——电源、时钟和复位。这些看似简单的电路模块&#xff0c;实则是整个系…...

从零开始的Linux#2 vim编辑器

介绍vi\vim是Linux中最经典的文本编辑器&#xff0c;vim是vi的全面升级版本&#xff0c;我们后面只用vim通过vim编辑器编辑文件&#xff0c;需要使用命令vim 文件路径如果文件路径表示的文件不存在&#xff0c;那么此命令会用于编辑新文件&#xff1b;如果存在则编辑已有文件模…...