From 5949ede8f2b32e538a50f0fbed18693a1b8aa2c7 Mon Sep 17 00:00:00 2001 From: fuhongben Date: Wed, 4 Dec 2024 10:26:58 +0800 Subject: [PATCH 1/5] =?UTF-8?q?readme=E6=B7=BB=E5=8A=A0mxIndex=E8=AF=B4?= =?UTF-8?q?=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 3 ++- README.zh.md | 3 ++- mxIndex/README.md | 11 +++++++++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 9fa7f8348..0026d6260 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ EN|[CN](README.zh.md) [MindX SDK](https://www.hiascend.com/software/mindx-sdk) is a software development kit (SDK) launched by Huawei, offering simple and easy-to-use, high-performance APIs and tools. It includes multiple SDKs such as mxVision (visual analysis), mxRAG (knowledge enhancement), mxIndex (feature retrieval), and mxRec (search recommendation), aiding the Ascend AI processor in empowering various application scenarios. -To help developers quickly master the use of mxVision and mxRAG interfaces and rapidly implement business functions, this code repository (mxSdkReferenceApps) provides various reference samples developed based on mxVision and mxRAG. Users can select the appropriate sample code according to their needs. +To help developers quickly master the use of mxVision, mxRAG and mxIndex interfaces and rapidly implement business functions, this code repository (mxSdkReferenceApps) provides various reference samples developed based on mxVision, mxRAG and mxIndex. Users can select the appropriate sample code according to their needs. ## Main Directory Structure and Description | 目录 | 说明 | |---|-----------------------------------------------| @@ -12,6 +12,7 @@ To help developers quickly master the use of mxVision and mxRAG interfaces and r | [mxVision](./mxVision) | mxVision official sample directory | | [tutorials](./tutorials) | mxVision official tutorials directory | | [mxRAG](./mxRAG) | mxRAG offical sample directory | +| [mxIndex](./mxIndex) | mxIndex offical sample directory | ## Related Websites diff --git a/README.zh.md b/README.zh.md index 2db93081f..bfe7f2cbb 100644 --- a/README.zh.md +++ b/README.zh.md @@ -3,7 +3,7 @@ [MindX SDK](https://www.hiascend.com/software/mindx-sdk) 是华为推出的软件开发套件(SDK),提供极简易用、高性能的API和工具,包含mxVision(视觉分析)、mxRAG(知识增强)、mxIndex(特征检索)、mxRec(搜索推荐)等多个SDK,助力昇腾AI处理器赋能各应用场景。 -为助力开发者快速掌握mxVision和mxRAG接口的使用、快速实现业务功能,本代码仓(mxSdkReferenceApps)提供了基于mxVision和mxRAG开发的各类参考样例。用户可根据自身需求选择相应案例代码。 +为助力开发者快速掌握mxVision,mxRAG接口和mxIndex接口的使用、快速实现业务功能,本代码仓(mxSdkReferenceApps)提供了基于mxVision, mxRAG和mxIndex开发的各类参考样例。用户可根据自身需求选择相应案例代码。 @@ -16,6 +16,7 @@ | [mxVision](./mxVision) | mxVision官方应用样例目录 | | [tutorials](./tutorials) | mxVision官方开发样例和文档参考工程目录 | | [mxRAG](./mxRAG) | mxRAG参考样例目录 | +| [mxIndex](./mxIndex) | mxIndex参考样例目录 | ## 相关网站 diff --git a/mxIndex/README.md b/mxIndex/README.md index 30c00f358..6a96fda60 100644 --- a/mxIndex/README.md +++ b/mxIndex/README.md @@ -3,9 +3,16 @@ #### 介绍 **本仓库提供了昇腾MindX SDK index组件实现的几种常见检索算法的demo** -**master分支**对应版本mxIndex 6.0.RC2、mxIndex 6.0.RC1,依赖faiss版本为1.7.4 +#### 版本配套表 +| MindX SDK版本 | mxIndex版本 | CANN版本 | HDK版本 | 硬件形态 | +| -------------- | ------------ | -------- | -------- | --------- | +| master | 6.0.RC3 | 8.0.RC3 | 24.1.RC2 | Atlas推理系列产品 Atlas200/300/500 800I A2推理产品 | -**mxIndex-faiss1.7.1分支**对应版本mxIndex 5.0.0、mxIndex 5.0.1,依赖faiss版本为1.7.1 +之前版本请参见:https://gitee.com/ascend/ascend-referenceapps/tree/master/mxIndex_samples + +master分支对应版本mxIndex 6.0.RC2、mxIndex 6.0.RC1,依赖faiss版本为1.7.4 + +mxIndex-faiss1.7.1分支对应版本mxIndex 5.0.0、mxIndex 5.0.1,依赖faiss版本为1.7.1 #### 关于MindX SDK 更多信息 请关注昇腾社区[MindX SDK](https://www.hiascend.com/zh/software/mindx-sdk)的最新版本 -- Gitee From 226ead93c20776b67042c634686a8bf0143253d7 Mon Sep 17 00:00:00 2001 From: fuhongben Date: Wed, 11 Dec 2024 09:06:02 +0000 Subject: [PATCH 2/5] =?UTF-8?q?update=20mxIndex/TestAscendIndexIVFSP.cpp.?= =?UTF-8?q?=20=E4=BF=AE=E6=94=B9=E5=A4=9Aindex=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: fuhongben --- mxIndex/TestAscendIndexIVFSP.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/mxIndex/TestAscendIndexIVFSP.cpp b/mxIndex/TestAscendIndexIVFSP.cpp index f86ced1ea..2d9602645 100644 --- a/mxIndex/TestAscendIndexIVFSP.cpp +++ b/mxIndex/TestAscendIndexIVFSP.cpp @@ -464,10 +464,17 @@ void MultiSearchAndMultiSearchFilter() std::vector indexes; for (int i = 0; i < INDEX_NUM; ++i) { - auto index = new faiss::ascend::AscendIndexIVFSP(dim, nonzeroNum, nlist, - codeBookPath.c_str(), - faiss::ScalarQuantizer::QuantizerType::QT_8bit, - faiss::MetricType::METRIC_L2, conf); + faiss::ascend::AscendIndexIVFSP* index; + if (i == 0) { + index = new faiss::ascend::AscendIndexIVFSP(dim, nonzeroNum, nlist, + codeBookPath.c_str(), faiss::ScalarQuantizer::QuantizerType::QT_8bit, + faiss::MetricType::METRIC_L2, conf); + } else { + index = new faiss::ascend::AscendIndexIVFSP(dim, nonzeroNum, nlist, + *(faiss::ascend::AscendIndexIVFSP*)indexes[0], faiss::ScalarQuantizer::QuantizerType::QT_8bit, + faiss::MetricType::METRIC_L2, conf); + } + index->setVerbose(true); indexes.emplace_back(index); printf("create index:%d\n", i); -- Gitee From a94822fa141f0da5ae47d06581dcefae6c908f86 Mon Sep 17 00:00:00 2001 From: fuhongben Date: Wed, 11 Dec 2024 09:07:43 +0000 Subject: [PATCH 3/5] update mxIndex/faiss-python/ascendfaiss.py. Signed-off-by: fuhongben --- mxIndex/faiss-python/ascendfaiss.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mxIndex/faiss-python/ascendfaiss.py b/mxIndex/faiss-python/ascendfaiss.py index c155bf681..0dbc44599 100644 --- a/mxIndex/faiss-python/ascendfaiss.py +++ b/mxIndex/faiss-python/ascendfaiss.py @@ -33,6 +33,8 @@ try: from .swig_ascendfaiss import Index, index_ascend_to_cpu from .swig_ascendfaiss import AscendIndexInt8, AscendIndexFlatL2 from .swig_ascendfaiss import AscendIndexFlatConfig, index_cpu_to_ascend + from .swig_ascendfaiss import AscendIndexInt8FlatConfig, AscendIndexFlat + from .swig_ascendfaiss import swig_ptr except ImportError as e: logger.error("Loading ascendfaiss error") logger.error(e) -- Gitee From e5a6df8a5941ab799a147d2849a1075dedb434fc Mon Sep 17 00:00:00 2001 From: fuhongben Date: Wed, 11 Dec 2024 09:10:45 +0000 Subject: [PATCH 4/5] update mxIndex/TestAscendIndexIVFSP.cpp. Signed-off-by: fuhongben --- mxIndex/TestAscendIndexIVFSP.cpp | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/mxIndex/TestAscendIndexIVFSP.cpp b/mxIndex/TestAscendIndexIVFSP.cpp index 2d9602645..f86ced1ea 100644 --- a/mxIndex/TestAscendIndexIVFSP.cpp +++ b/mxIndex/TestAscendIndexIVFSP.cpp @@ -464,17 +464,10 @@ void MultiSearchAndMultiSearchFilter() std::vector indexes; for (int i = 0; i < INDEX_NUM; ++i) { - faiss::ascend::AscendIndexIVFSP* index; - if (i == 0) { - index = new faiss::ascend::AscendIndexIVFSP(dim, nonzeroNum, nlist, - codeBookPath.c_str(), faiss::ScalarQuantizer::QuantizerType::QT_8bit, - faiss::MetricType::METRIC_L2, conf); - } else { - index = new faiss::ascend::AscendIndexIVFSP(dim, nonzeroNum, nlist, - *(faiss::ascend::AscendIndexIVFSP*)indexes[0], faiss::ScalarQuantizer::QuantizerType::QT_8bit, - faiss::MetricType::METRIC_L2, conf); - } - + auto index = new faiss::ascend::AscendIndexIVFSP(dim, nonzeroNum, nlist, + codeBookPath.c_str(), + faiss::ScalarQuantizer::QuantizerType::QT_8bit, + faiss::MetricType::METRIC_L2, conf); index->setVerbose(true); indexes.emplace_back(index); printf("create index:%d\n", i); -- Gitee From 0871b89b40580331c87acc9b800fb075d8197d3e Mon Sep 17 00:00:00 2001 From: fuhongben Date: Wed, 11 Dec 2024 09:11:29 +0000 Subject: [PATCH 5/5] update mxIndex/faiss-python/ascendfaiss.py. Signed-off-by: fuhongben --- mxIndex/faiss-python/ascendfaiss.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/mxIndex/faiss-python/ascendfaiss.py b/mxIndex/faiss-python/ascendfaiss.py index 0dbc44599..c155bf681 100644 --- a/mxIndex/faiss-python/ascendfaiss.py +++ b/mxIndex/faiss-python/ascendfaiss.py @@ -33,8 +33,6 @@ try: from .swig_ascendfaiss import Index, index_ascend_to_cpu from .swig_ascendfaiss import AscendIndexInt8, AscendIndexFlatL2 from .swig_ascendfaiss import AscendIndexFlatConfig, index_cpu_to_ascend - from .swig_ascendfaiss import AscendIndexInt8FlatConfig, AscendIndexFlat - from .swig_ascendfaiss import swig_ptr except ImportError as e: logger.error("Loading ascendfaiss error") logger.error(e) -- Gitee