Index creation, image storage, image retrieval method, apparatus and electronic device

By creating and managing indexes for storage shards and backup shards in the ES cluster, the problem of low image storage and retrieval efficiency in a single-server architecture is solved, achieving more efficient image processing.

CN115391581BActive Publication Date: 2026-06-02HANGZHOU EZVIZ SOFTWARE CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HANGZHOU EZVIZ SOFTWARE CO LTD
Filing Date
2022-09-15
Publication Date
2026-06-02

AI Technical Summary

Technical Problem

Existing technologies, when the amount of facial data increases and retrieval demands rise, suffer from low efficiency in image storage and retrieval due to the single-server architecture, making it unable to effectively handle large amounts of facial data.

Method used

Storage shards and backup shards are created using the management nodes in the ES cluster, and then allocated among the storage nodes in the ES cluster using an index creation method, thereby improving image storage and retrieval efficiency.

Benefits of technology

By managing sharding and backup shards, the efficiency of image storage and retrieval is improved, solving the problem of low efficiency under a single-server architecture and achieving more efficient image processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115391581B_ABST
    Figure CN115391581B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide an index creation method, an image storage method, an image retrieval method, an image storage device, an image retrieval device and an electronic device, and relate to the technical field of image retrieval. The index creation method comprises: determining, based on a first number of storage nodes in an ES cluster, a second number of storage shards for storing images in a specified application scenario; sending an index creation request carrying the second number to a management node in the ES cluster, so that the management node determines, based on the second number, a storage shard corresponding to each storage node in the ES cluster after receiving the index creation request, creates a specified index corresponding to the specified application scenario, and creates a storage shard corresponding to the specified index in each storage node. Compared with the prior art, the application of the scheme provided by the embodiments of the present application can improve the efficiency of image storage and image retrieval.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image retrieval technology, and in particular to index creation, image storage, image retrieval methods, devices, and electronic equipment. Background Technology

[0002] Currently, with the rapid development of image retrieval technology, people can retrieve information about the object being identified by performing image retrieval. For example, facial recognition can be used for identity authentication or to query the activity trajectory of a target object. Therefore, image retrieval has important applications in fields such as personnel management and video surveillance.

[0003] In related technologies, a single-server architecture is used for face retrieval. However, this technology is only suitable for situations where memory is not limited and the amount of face data involved is limited. As the amount of face data stored increases, and the demand for face retrieval increases, using the above-mentioned technical solutions for face storage and retrieval may result in the number of face storage and retrieval tasks that the server needs to handle exceeding its processing limit, thus reducing the server's processing speed and leading to low efficiency in face retrieval and storage. Summary of the Invention

[0004] The purpose of this invention is to provide methods, apparatus, and electronic devices for index creation, image storage, and image retrieval, so as to improve the efficiency of image storage and image retrieval. The specific technical solutions are as follows:

[0005] In a first aspect, embodiments of the present invention provide an index creation method, the method comprising:

[0006] Based on the first number of storage nodes in the ES cluster, determine the second number of storage shards used to store images in a specified application scenario;

[0007] Send an index creation request carrying the second number to the management node in the ES cluster, so that after receiving the index creation request, the management node determines the storage shard corresponding to each storage node in the ES cluster based on the second number, creates the specified index corresponding to the specified application scenario, and creates the storage shard corresponding to the specified index in each storage node.

[0008] Optionally, in one specific implementation, the method further includes:

[0009] Based on the second quantity and the third quantity of backup shards associated with each storage shard, the backup shards corresponding to each storage node in the ES cluster are determined.

[0010] Sending index creation requests carrying the second number to the management node in the ES cluster, so that after receiving the index creation requests, the management node determines the storage shard corresponding to each storage node in the ES cluster based on the second number, creates the specified index corresponding to the specified application scenario, and creates the storage shard corresponding to the specified index in each storage node, includes:

[0011] Send an index creation request carrying the second number to the management node in the ES cluster, so that after receiving the index creation request, the management node determines the storage shard and backup shard corresponding to each storage node in the ES cluster based on the second number, creates the specified index corresponding to the specified application scenario, and creates the storage shard and backup shard corresponding to the specified index in each storage node.

[0012] Optionally, in one specific implementation, determining the storage shard corresponding to each storage node in the ES cluster based on the second quantity includes:

[0013] If the second quantity meets the preset conditions, then the storage shard corresponding to each storage node in the ES cluster is determined.

[0014] Optionally, in one specific implementation, determining the second number of storage shards for storing images in a specified application scenario based on the first number of storage nodes in the ES cluster includes:

[0015] Using the first formula, a second number of storage fragments for storing images in a specified application scenario is determined; wherein, the first formula is:

[0016] ;

[0017] in, For the second quantity, The number of backup shards associated with each storage shard. For the first quantity, It is a fixed constant.

[0018] Optionally, in one specific implementation, determining the storage shard corresponding to each storage node in the ES cluster if the second quantity meets a preset condition includes:

[0019] If the second quantity satisfies the second formula, then the storage shard corresponding to each storage node in the ES cluster is determined; wherein, the second formula is:

[0020] .

[0021] Secondly, embodiments of the present invention provide an image storage method applied to a management node in an Elasticsearch cluster, the method comprising:

[0022] Obtain an image storage request; wherein, the image storage request includes an image to be stored, image features of the image to be stored, and a target scene identifier of the target application scene to which the image to be stored belongs;

[0023] Determine the target index corresponding to the target scene identifier; wherein the target index is constructed according to an index creation method provided in the first aspect;

[0024] Generate an image identifier for the image to be stored, and based on the image identifier, determine the target storage segment for responding to the image storage request in each storage segment corresponding to the target index;

[0025] The image storage request and the image identifier are sent to the target node to which the target storage segment belongs, so that the target node stores the image to be stored, the image features, and the image identifier in the target storage segment.

[0026] Optionally, in one specific implementation, each storage shard is associated with at least one backup shard, and the method further includes:

[0027] The image storage request and the image identifier are sent to the target backup node to which the target backup partition associated with the target storage partition belongs, so that the target backup node stores the image to be stored, the image features, and the image identifier in the target backup partition.

[0028] For each storage shard, the storage shard and at least one backup shard associated with it belong to different storage nodes.

[0029] Optionally, in one specific implementation, determining the target storage fragment for responding to the image storage request among the storage fragments corresponding to the target index based on the image identifier includes:

[0030] The target storage fragment for responding to the image storage request is determined using the third formula; wherein the third formula is expressed as:

[0031]

[0032] in, The fragment identifier for the target storage fragment. For the image identifier, The hash value of the ID determined using a hash algorithm, This refers to the number of storage shards corresponding to the target index.

[0033] Thirdly, embodiments of the present invention provide an image storage method applied to a management node in an ES cluster, the method comprising:

[0034] Obtain an image retrieval request; wherein, the image retrieval request includes the image features to be retrieved and the retrieval scene identifier of the application scene to which the image to be retrieved belongs;

[0035] Determine the index to be retrieved corresponding to the scene identifier to be retrieved; wherein the index to be retrieved is constructed according to an index creation method provided in the first aspect;

[0036] The image retrieval request is sent to the retrieval nodes to which each retrieval storage shard belongs, corresponding to the retrieval index. After receiving the image retrieval request, each retrieval node performs an image retrieval in the retrieval storage shard included in each retrieval node according to the image features of the image to be retrieved, and feeds back the retrieval results to the management node.

[0037] Obtain the search results from each node to be searched, and determine the target response result of the image search request based on the obtained search results.

[0038] Optionally, in one specific implementation, the step of performing image retrieval in the storage segments to be retrieved within each node to be retrieved, based on the image features of the image to be retrieved, includes:

[0039] For each storage segment to be retrieved that includes each node to be retrieved, the feature similarity between the image features of the image to be retrieved and the image features of each image in the storage segment to be retrieved is calculated to obtain the retrieval results for the node to be retrieved.

[0040] Optionally, in one specific implementation, the search results returned by each node to be searched include:

[0041] The priority queue includes multiple entries; wherein each entry is arranged in descending order of the included feature similarity, each entry corresponds to an image in the storage segment to be retrieved included in the node to be retrieved, and each entry includes: the image corresponding to the entry, the feature similarity between the image features of the image corresponding to the entry and the image features of the image to be retrieved, and the image identifier of the image corresponding to the entry.

[0042] Optionally, in one specific implementation, determining the target response result of the image retrieval request based on the acquired retrieval results includes:

[0043] Arrange the entries in the obtained search results in descending order of feature similarity, and determine the images included in the entries arranged before the preset position as the target response results of the image retrieval request.

[0044] Optionally, in one specific implementation, the method further includes:

[0045] In the preset information storage space, additional information associated with each target image in the target response result is obtained.

[0046] Optionally, in one specific implementation, the method further includes:

[0047] Output the target response result.

[0048] Optionally, in one specific implementation, each storage shard to be retrieved is associated with at least one backup shard to be retrieved;

[0049] When multiple image retrieval requests including the scene identifier to be retrieved are received, the step of sending the image retrieval requests to the retrieval nodes belonging to each retrieval storage shard corresponding to the retrieval index, so that each retrieval node, upon receiving the image retrieval request, performs image retrieval within the included retrieval storage shard based on the image features of the image to be retrieved, includes:

[0050] Starting with the first image retrieval request, each image retrieval request is sent sequentially to the target retrieval node corresponding to a set of target shards of the index to be retrieved, according to a preset polling order. This allows each target retrieval node to perform image retrieval in the included target shards based on the image features of the image to be retrieved after receiving the image retrieval request.

[0051] Each target shard group includes: all storage shards to be retrieved, or one backup shard to be retrieved associated with each of the storage shards to be retrieved.

[0052] Fourthly, embodiments of the present invention provide an index creation apparatus, the apparatus comprising:

[0053] The second quantity determination module is used to determine the second quantity of storage shards for storing images in a specified application scenario based on the first quantity of storage nodes in the ES cluster.

[0054] The index creation module is used to send an index creation request carrying the second number to the management node in the ES cluster, so that after receiving the index creation request, the management node determines the storage shard corresponding to each storage node in the ES cluster based on the second number, creates the specified index corresponding to the specified application scenario, and creates the storage shard corresponding to the specified index in each storage node.

[0055] Optionally, in one specific implementation, the apparatus further includes:

[0056] The backup sharding module is used to determine the backup shards corresponding to each storage node in the ES cluster based on the second quantity and the third quantity of backup shards associated with each preset storage shard.

[0057] The index creation module is specifically used for:

[0058] Send an index creation request carrying the second number to the management node in the ES cluster, so that after receiving the index creation request, the management node determines the storage shard corresponding to each storage node in the ES cluster based on the second number, creates the specified index corresponding to the specified application scenario, and creates the storage shard and backup shard corresponding to the specified index in each storage node.

[0059] Optionally, in one specific implementation, the index creation module is specifically used for:

[0060] If the second quantity meets the preset conditions, then the storage shard corresponding to each storage node in the ES cluster is determined.

[0061] Optionally, in one specific implementation, the second quantity determination module is specifically used for:

[0062] Using the first formula, a second number of storage fragments for storing images in a specified application scenario is determined; wherein, the first formula is:

[0063] ;

[0064] in, For the second quantity, The number of backup shards associated with each storage shard. For the first quantity, It is a fixed constant.

[0065] Optionally, in one specific implementation, the index creation module is specifically used for:

[0066] If the second quantity satisfies the second formula, then the storage shard corresponding to each storage node in the ES cluster is determined; wherein, the second formula is:

[0067] .

[0068] Fifthly, embodiments of the present invention provide an image storage device applied to a management node in an ES cluster, the device comprising:

[0069] An image storage request module is used to obtain an image storage request; wherein, the image storage request includes an image to be stored, image features of the image to be stored, and a target scene identifier of the target application scene to which the image to be stored belongs;

[0070] A target index determination module is used to determine the target index corresponding to the target scene identifier; wherein the target index is constructed according to an index creation method provided in the first aspect;

[0071] The target storage fragment determination module is used to generate an image identifier for the image to be stored, and based on the image identifier, determine the target storage fragment for responding to the image storage request in each storage fragment corresponding to the target index;

[0072] The target storage shard storage module is used to send the image storage request and the image identifier to the target node to which the target storage shard belongs, so that the target node stores the image to be stored, the image features, and the image identifier in the target storage shard.

[0073] Optionally, in one specific implementation, each storage shard is associated with at least one backup shard, and the apparatus further includes:

[0074] The backup shard storage module is used to send the image storage request and the image identifier to the target backup node to which the target backup shard associated with the target storage shard belongs, so that the target backup node stores the image to be stored, the image features and the image identifier in the target backup shard accordingly;

[0075] For each storage shard, the storage shard and at least one backup shard associated with it belong to different storage nodes.

[0076] Optionally, in one specific implementation, the target storage fragment determination module is specifically used for:

[0077] The target storage fragment for responding to the image storage request is determined using the third formula; wherein the third formula is expressed as:

[0078]

[0079] in, The fragment identifier for the target storage fragment. For the image identifier, The hash value of the ID determined using a hash algorithm, This refers to the number of storage shards corresponding to the target index.

[0080] Sixthly, embodiments of the present invention provide an image retrieval device applied to a management node in an ES cluster, the device comprising:

[0081] An image retrieval request module is used to obtain an image retrieval request; wherein, the image retrieval request includes the image features to be retrieved and the retrieval scene identifier of the application scene to which the image to be retrieved belongs;

[0082] The index to be retrieved module is used to determine the index to be retrieved corresponding to the scenario identifier to be retrieved; wherein the index to be retrieved is constructed according to an index creation method provided in the first aspect;

[0083] The search result acquisition module is used to send the image search request to the search nodes to which each search storage segment corresponding to the search index belongs, so that each search node, after receiving the image search request, performs image search in the search storage segment included in each search node according to the image features of the image to be searched, and feeds back the obtained search results to the management node.

[0084] The target response result acquisition module is used to acquire the search results fed back by each node to be searched, and determine the target response result of the image search request based on the acquired search results.

[0085] Optionally, in one specific implementation, the retrieval result acquisition module is specifically used for:

[0086] For each storage segment to be retrieved that includes each node to be retrieved, the feature similarity between the image features of the image to be retrieved and the image features of each image in the storage segment to be retrieved is calculated to obtain the retrieval results for the node to be retrieved.

[0087] Optionally, in one specific implementation, the search results returned by each node to be searched include:

[0088] The priority queue includes multiple entries; wherein each entry is arranged in descending order of the included feature similarity, each entry corresponds to an image in the storage segment to be retrieved included in the node to be retrieved, and each entry includes: the image corresponding to the entry, the feature similarity between the image features of the image corresponding to the entry and the image features of the image to be retrieved, and the image identifier of the image corresponding to the entry.

[0089] Optionally, in one specific implementation, the target response result acquisition module is specifically used for:

[0090] Arrange the entries in the obtained search results in descending order of feature similarity, and determine the images included in the entries arranged before the preset position as the target response results of the image retrieval request.

[0091] Optionally, in one specific implementation, the apparatus further includes:

[0092] The additional information acquisition module is used to acquire additional information associated with each target image in the target response result from a preset information storage space.

[0093] Optionally, in one specific implementation, the apparatus further includes:

[0094] The output module is used to output the target response result.

[0095] Optionally, in one specific implementation, each storage shard to be retrieved is associated with at least one backup shard to be retrieved;

[0096] When multiple image retrieval requests including the identifier of the scene to be retrieved are received, the retrieval result acquisition module is specifically used for:

[0097] Starting with the first image retrieval request, each image retrieval request is sent sequentially to the target retrieval node corresponding to a set of target shards of the index to be retrieved, according to a preset polling order. This allows each target retrieval node to perform image retrieval in the included target shards based on the image features of the image to be retrieved after receiving the image retrieval request.

[0098] Each target shard group includes: all storage shards to be retrieved, or one backup shard to be retrieved associated with each of the storage shards to be retrieved.

[0099] In a seventh aspect, embodiments of the present invention provide an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus;

[0100] Memory, used to store computer programs;

[0101] When a processor executes a program stored in memory, it implements the steps of any of the index creation methods provided in the first aspect above.

[0102] Eighthly, embodiments of the present invention provide a computer-readable medium storing a computer program that, when executed by a processor, implements the steps of any of the index creation methods provided in the first aspect.

[0103] Ninthly, embodiments of the present invention provide an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus;

[0104] Memory, used to store computer programs;

[0105] When a processor executes a program stored in memory, it implements the steps of any of the image storage methods provided in the second aspect above, and / or the steps of any of the image retrieval methods provided in the third aspect.

[0106] In a tenth aspect, embodiments of the present invention provide a computer-readable medium storing a computer program, wherein the computer program, when executed by a processor, implements the steps of any image storage method provided in the second aspect and / or the steps of any image retrieval method provided in the third aspect.

[0107] Eleventhly, embodiments of the present invention provide a computer program product containing instructions that, when run on a computer, cause the computer to perform the steps of any of the index creation methods provided in the first aspect.

[0108] In a twelfth aspect, embodiments of the present invention provide a computer program product containing instructions that, when run on a computer, cause the computer to perform the steps of any of the image storage methods provided in the second aspect above, and / or the steps of any of the image retrieval methods provided in the third aspect.

[0109] Beneficial effects of the embodiments of the present invention:

[0110] As can be seen from the above, when building an index based on ES (Elastic Search, or ES for distributed full-text search) using the solution provided in the embodiments of the present invention, firstly, a second number of storage shards for storing images in a specified application scenario can be determined based on a first number of storage nodes in the ES cluster. Then, an index creation request carrying the second number can be sent to the management node in the ES cluster. After receiving the index creation request, the management node can determine the storage shards corresponding to each storage node in the ES cluster based on the second number, create the specified index corresponding to the specified application scenario, and create the storage shards corresponding to the specified index in each storage node.

[0111] Based on this, by applying the solution provided in the embodiments of the present invention, an index creation request carrying a second number of storage shards for storing images in a specified application scenario can be sent to the management node in the ES cluster. This allows the management node to create a specified index corresponding to the specified application scenario based on the index creation request, and to create storage shards corresponding to the specified index in each storage node. Thus, when performing image storage and image retrieval, the constructed index can be used for storage and retrieval, thereby improving the efficiency of image storage and image retrieval. Attached Figure Description

[0112] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other embodiments can be obtained based on these drawings.

[0113] Figure 1 This is a flowchart illustrating an index creation method provided in an embodiment of the present invention;

[0114] Figure 2 A flowchart illustrating another index creation method provided in an embodiment of the present invention;

[0115] Figure 3 This is a flowchart illustrating an image storage method provided in an embodiment of the present invention;

[0116] Figure 4 A flowchart illustrating another image storage method provided in an embodiment of the present invention;

[0117] Figure 5 This is a schematic flowchart of an image retrieval method provided in an embodiment of the present invention;

[0118] Figure 6 This is a flowchart illustrating a specific embodiment of the present invention;

[0119] Figure 7 This is a schematic diagram of the structure of an index creation device provided in an embodiment of the present invention;

[0120] Figure 8 This is a schematic diagram of the structure of an image storage device provided in an embodiment of the present invention;

[0121] Figure 9 This is a schematic diagram of the structure of an image retrieval device provided in an embodiment of the present invention;

[0122] Figure 10 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention;

[0123] Figure 11 This is a schematic diagram of another electronic device provided in an embodiment of the present invention. Detailed Implementation

[0124] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art based on this application are within the scope of protection of the present invention.

[0125] In related technologies, a single-server architecture is used for face retrieval. However, this technology is only suitable for situations where memory is not limited and the amount of face data involved is limited. As the amount of face data stored increases, and the demand for face retrieval increases, using the above-mentioned technical solutions for face storage and retrieval may result in the number of face storage and retrieval tasks that the server needs to handle exceeding its processing limit, thus reducing the server's processing speed and leading to low efficiency in face retrieval and storage.

[0126] To address the aforementioned technical problems, embodiments of the present invention provide an index creation method.

[0127] This method is applicable to various data storage and retrieval scenarios, such as facial image retrieval and storage. Furthermore, it can be applied to various electronic devices, including laptops, tablets, and desktop computers (hereinafter referred to as electronic devices). These devices can execute the method by running a pre-installed client or a pre-installed functional module. Therefore, this embodiment of the invention does not limit the application scenarios or the executing entity of the method.

[0128] An index creation method provided in this embodiment of the invention may include the following steps:

[0129] Based on the first number of storage nodes in the ES cluster, determine the second number of storage shards used to store images in a specified application scenario;

[0130] Send an index creation request carrying the second number to the management node in the ES cluster, so that after receiving the index creation request, the management node determines the storage shard corresponding to each storage node in the ES cluster based on the second number, creates the specified index corresponding to the specified application scenario, and creates the storage shard corresponding to the specified index in each storage node.

[0131] As can be seen from the above, when building an index based on Elasticsearch using the solution provided in the embodiments of the present invention, firstly, a second number of storage shards for storing images in a specified application scenario can be determined based on a first number of storage nodes in the Elasticsearch cluster. Then, an index creation request carrying the second number can be sent to the management node in the Elasticsearch cluster. After receiving the index creation request, the management node determines the storage shards corresponding to each storage node in the Elasticsearch cluster based on the second number, creates a specified index corresponding to the specified application scenario, and creates storage shards corresponding to the specified index in each storage node.

[0132] Based on this, by applying the solution provided in the embodiments of the present invention, an index creation request carrying a second number of storage shards for storing images in a specified application scenario can be sent to the management node in the ES cluster. This allows the management node to create a specified index corresponding to the specified application scenario based on the index creation request, and to create storage shards corresponding to the specified index in each storage node. Thus, when performing image storage and image retrieval, the constructed index can be used for storage and retrieval, thereby improving the efficiency of image storage and image retrieval.

[0133] The following is a detailed description of an index creation method provided by an embodiment of the present invention, with reference to the accompanying drawings.

[0134] Figure 1 This is a flowchart illustrating an index creation method provided in an embodiment of the present invention, as shown below. Figure 1 As shown, the method includes the following steps S101-S102:

[0135] S101: Based on the first number of storage nodes in the ES cluster, determine the second number of storage shards to store images in a specified application scenario.

[0136] Before using Elasticsearch (ES)-based indexes for storage or retrieval, ES-based indexes can be pre-built. Therefore, an ES cluster can be pre-built, which includes multiple storage nodes.

[0137] An Elasticsearch (ES) cluster is a P2P (peer-to-peer) type distributed system (using the gossip protocol). Except for cluster state management, all other requests can be sent to any node in the cluster. This node can find out which nodes to forward the request to and communicate directly with these nodes.

[0138] P2P refers to a system where clients can communicate directly, and the two parties communicating are called peers. Peers can share resources, such as files.

[0139] Since the number of storage nodes in the ES cluster is known, the electronic device can determine the number of storage nodes in the ES cluster as a first number after receiving the index creation request, and determine the second number of storage shards used to store images in the specified application scenario based on the first number.

[0140] S102: Send an index creation request carrying a second number to the management node in the ES cluster, so that after receiving the index creation request, the management node determines the storage shard corresponding to each storage node in the ES cluster based on the second number, creates the specified index corresponding to the specified application scenario, and creates the storage shard corresponding to the specified index in each storage node.

[0141] After determining the second number of storage shards in the ES cluster used to store images in a specified application scenario, an index creation request carrying the second number can be sent to the management node in the ES cluster. Thus, after receiving the request, the management node can determine the storage shards corresponding to each storage node in the ES cluster based on the obtained second number of storage shards in the ES cluster.

[0142] In order to balance the data stored on each storage node in the ES cluster, the second number of storage shards determined above can be distributed among the storage nodes.

[0143] Optionally, when the second number of storage shards in the ES cluster is less than the first number of storage nodes in the ES cluster, a second number of storage nodes can be selected from among the storage nodes in the ES cluster, thereby allocating a storage shard to each storage node.

[0144] When the second number of storage shards in the ES cluster is an integer multiple of the first number of storage nodes in the ES cluster, the storage shards can be evenly distributed among the storage shards.

[0145] In this way, the aforementioned management nodes can create corresponding specified indexes for specific application scenarios and create storage shards corresponding to the specified indexes on each storage node.

[0146] In other words, an electronic device can send a second number of index creation requests, carrying a set of storage shards for storing images in a specified application scenario, to any storage node in the Elasticsearch (ES) cluster. This storage node can then forward these requests to the management node in the ES cluster. Upon receiving these second number of index creation requests, the management node can determine the corresponding storage shards for each storage node in the ES cluster based on these second numbers. According to the resource information of each storage node in the ES cluster, such as remaining memory, remaining disk space, and the number of existing shards, the management node can then forward the index creation requests to the corresponding storage nodes. Upon receiving the requests, the storage nodes can create the specified index for the specified application scenario and create the corresponding storage shards for that specified index within the storage node.

[0147] For example, the management node in the ES cluster is node A, and the second number of storage shards in the ES cluster used to store images in a specified application scenario is 2, including storage node B and storage node C.

[0148] The electronic device sends a second number of index creation requests to node A in the ES cluster. Upon receiving the index creation requests, node A can determine, based on the second number, the storage shard corresponding to storage node B in the ES cluster as storage shard b1, and the storage shard corresponding to storage node C as storage shard c1. Based on the specified application scenario corresponding to storage shard b1 (crossroads), it creates a specified index 1 for the crossroads, and based on the specified application scenario corresponding to storage shard c1 (shop entrance), it creates a specified index 2 for the shop entrance. The electronic device then creates storage shard b1 corresponding to specified index 1 in storage node B and storage shard c1 corresponding to specified index 2 in storage node C.

[0149] Alternatively, the Elasticsearch cluster can be a decentralized cluster, meaning there is no specific management node. Therefore, any storage node in the Elasticsearch cluster can function as both a management node and a node capable of data storage and retrieval.

[0150] Therefore, optionally, the electronic device can send an index creation request carrying a second number to any storage node in the ES cluster, so that after receiving the index creation request, any storage node can determine the storage shard corresponding to each storage node in the ES cluster based on the second number, create a specified index commonly used by the specified application, and create the storage shard corresponding to the specified index in each storage node.

[0151] For example, the second number of storage shards in an ES cluster used to store images in a specified application scenario is 2, including storage node B and storage node C.

[0152] Therefore, after sending an index creation request carrying a second number of storage fragments for storing images in a specified application scenario to either storage node B or storage node C in the aforementioned ES cluster, the electronic device can determine, based on the second number, that the storage fragment corresponding to storage node B in the ES cluster is storage fragment b1, and the storage fragment corresponding to storage node C is storage fragment c1.

[0153] If an electronic device sends a second number of index creation requests to storage node B in the aforementioned ES cluster, then upon receiving the index creation requests, storage node B can create a specified index 1 for the specified application scenario corresponding to the crossroads, based on storage shard b1, and a specified index 2 for the specified application scenario corresponding to the shop entrance, based on storage shard c1. Storage node B will then create storage shard b1 corresponding to specified index 1, and storage node C will create storage shard c1 corresponding to specified index 2.

[0154] If an electronic device sends a second number of index creation requests to storage node C in the aforementioned ES cluster, then upon receiving the index creation requests, storage node C can create a specified index 1 for the specified application scenario corresponding to the crossroads, based on storage shard b1, and a specified index 2 for the specified application scenario corresponding to the shop entrance, based on storage shard c1. Storage shard b1 corresponding to specified index 1 will be created in storage node B, and storage shard c1 corresponding to specified index 2 will be created in storage node C.

[0155] To improve the disaster recovery capability of electronic devices, at least one backup shard can be configured for each storage shard. In this way, when a storage shard fails, the backup shard can be used to continue executing tasks, thereby improving the stability of electronic devices in performing tasks.

[0156] Based on this, in one optional implementation, such as Figure 2The diagram shown is a flowchart of an index creation method provided in an embodiment of the present invention. The index creation method provided in this embodiment may further include the following step S201:

[0157] S201: Based on the second number and the third number of backup fragments associated with each storage fragment, determine the backup fragments corresponding to each storage node in the ES cluster.

[0158] In this specific implementation, in order to improve the disaster recovery capability of electronic devices, at least one backup shard can be configured for each storage shard.

[0159] Therefore, after obtaining the second number of storage shards in the ES cluster, the backup shards corresponding to each storage node in the ES cluster can be determined based on the second number and the third number of backup shards associated with each storage shard.

[0160] Accordingly, step S102 above may include the following step S1021:

[0161] S1021: Send an index creation request carrying a second number to the management node in the ES cluster, so that after receiving the index creation request, the management node determines the storage shard and backup shard corresponding to each storage node in the ES cluster based on the second number, creates the specified index corresponding to the specified application scenario, and creates the storage shard and backup shard corresponding to the specified index in each storage node.

[0162] In this specific implementation, after determining the second number of storage shards in the ES cluster used to store images in a specified application scenario, an index creation request carrying the second number can be sent to the management node in the ES cluster. This allows the management node to create a corresponding specified index for the specified application scenario upon receiving the request, and to create storage shards and backup shards corresponding to the specified index in each storage node. Furthermore, when a storage shard fails, the backup shard can be used to continue executing the task, thereby further improving the stability of the electronic device in executing tasks.

[0163] For example, the management node in the ES cluster is node A, and the second number of storage shards in the ES cluster used to store images in a specified application scenario is 2, including storage node B and storage node C.

[0164] In the Elasticsearch cluster, storage node B corresponds to storage shard b1, and storage node C corresponds to storage shard c1. Storage shard b1 is associated with backup shard b11, and storage shard c1 is associated with backup shard c11.

[0165] The electronic device sends a second number of index creation requests to node A in the aforementioned Elasticsearch (ES) cluster. Upon receiving these requests, node A can determine, based on the second number, the storage shard corresponding to storage node B in the ES cluster as storage shard b1, and the storage shard corresponding to storage node C as storage shard c1. Storage shard b1 is associated with backup shard b11, and storage shard c1 is associated with backup shard c11. Then, based on the specified application scenario (crossroads) corresponding to storage shard b1, a specified index 1 is created for the crossroads; and based on the specified application scenario (shop entrance) corresponding to storage shard c1, a specified index 2 is created for the shop entrance. Storage shard b1 and backup shard b11 corresponding to specified index 1 are created in storage node B, and storage shard c1 and backup shard c11 corresponding to specified index 2 are created in storage node C.

[0166] Optionally, in one specific implementation, step S101 above may include the following step 11:

[0167] Step 11: Using the first formula, determine the second number of storage fragments used to store images in the specified application scenario; wherein, the first formula is:

[0168] ;

[0169] in, For the second quantity, The number of backup shards associated with each storage shard. As the first quantity, It is a fixed constant.

[0170] For example, the first number of storage nodes in an ES cluster The value is 2, representing the number of backup shards associated with each storage shard. =1, a fixed constant If the value is 3, then using the first formula, the second number P of storage fragments used to store images in the specified application scenario is determined as follows: .

[0171] Increasing the number of backup shards associated with each storage shard can provide greater parallel computing power for the index in the Elasticsearch cluster, thereby improving the efficiency of image retrieval and image storage.

[0172] Since the amount of memory in the pre-built storage space is limited, in order for the electronic device to perform the above index creation process, a preset condition can be set in advance regarding whether the second number of the above storage fragments is reasonable, so as to determine whether the second number meets the preset condition.

[0173] Based on this, in one optional implementation, step S102 above, determining the storage shard corresponding to each storage node in the ES cluster based on the second quantity, may include the following step 22:

[0174] Step 22: If the second quantity meets the preset conditions, then determine the storage shard corresponding to each storage node in the ES cluster.

[0175] In this specific implementation, a preset condition can be set in advance regarding whether the second number of the aforementioned storage fragments is reasonable.

[0176] Therefore, after determining the second number of storage fragments used to store images in a specified application scenario, it can be determined whether the second number meets the preset conditions.

[0177] If the conditions are met, then the storage shard corresponding to each storage node in the above ES cluster can be determined.

[0178] If the conditions are not met, the second number of storage fragments can be adjusted so that the second number can meet the preset conditions.

[0179] Optionally, in one specific implementation, step 22 above may include the following step 33:

[0180] Step 33: If the second quantity satisfies the second formula, then determine the storage shard corresponding to each storage node in the ES cluster; where the second formula is:

[0181] .

[0182] In this specific implementation, it can be determined whether the second number of storage shards in the ES cluster used to store images in a specified application scenario satisfies the second formula. If it does, then the storage shards corresponding to each storage node in the ES cluster are determined.

[0183] in, This is the second number of storage shards in the Elasticsearch cluster used to store images for a specified application scenario. The number of backup shards associated with each storage shard. This represents the initial number of storage nodes in the Elasticsearch cluster, with % indicating the modulo operation.

[0184] In other words, the sum of the number of backup shards associated with each storage shard plus 1 is multiplied by the determined second number. The remainder of the resulting multiplication is used as the result, and this result is multiplied by the first number of storage nodes in the ES cluster. When this multiplication equals zero, the storage shard corresponding to each storage node in the ES cluster is determined.

[0185] Optionally, if the second quantity does not satisfy the second formula above, the second quantity of the storage fragments can be adjusted so that the second quantity can satisfy the second formula above.

[0186] For example, the first number of storage nodes in an ES cluster The value is 2, representing the number of backup shards associated with each storage shard. =1, the second number of storage shards in the ES cluster used to store images for the specified application scenario. If it is 3, then .

[0187] As can be seen from the above, when building an index based on Elasticsearch using the solution provided in the embodiments of the present invention, firstly, a second number of storage shards for storing images in a specified application scenario can be determined based on a first number of storage nodes in the Elasticsearch cluster. Then, an index creation request carrying the second number can be sent to the management node in the Elasticsearch cluster. After receiving the index creation request, the management node determines the storage shards corresponding to each storage node in the Elasticsearch cluster based on the second number, creates a specified index corresponding to the specified application scenario, and creates storage shards corresponding to the specified index in each storage node.

[0188] Based on this, by applying the solution provided in the embodiments of the present invention, an index creation request carrying a second number of storage shards for storing images in a specified application scenario can be sent to the management node in the ES cluster. This allows the management node to create a specified index corresponding to the specified application scenario based on the index creation request, and to create storage shards corresponding to the specified index in each storage node. Thus, when performing image storage and image retrieval, the constructed index can be used for storage and retrieval, thereby improving the efficiency of image storage and image retrieval.

[0189] Corresponding to the index creation method provided in the above embodiments of the present invention, the present invention provides an image storage method, which is applied to the management node in an ES cluster.

[0190] Figure 3 This is a flowchart illustrating an image storage method provided in an embodiment of the present invention, as shown below. Figure 3 As shown, the method includes the following steps S301-S304.

[0191] S301: Obtain image storage request;

[0192] The image storage request includes the image to be stored, the image features of the image to be stored, and the target scene identifier of the target application scene to which the image to be stored belongs.

[0193] The purpose of stored images varies depending on the application scenario. For example, a physical store can use electronic devices to capture and store images of customers entering the store for better customer management. Similarly, security guards can use electronic devices to capture and store images of people entering the store to ensure the safety of residents in case of suspicious individuals.

[0194] Therefore, for image storage in different application scenarios, a target scene identifier of the target application scenario to which the image belongs can be added to the image to be stored, so as to classify and categorize the images stored in the storage space, thereby improving the efficiency of image storage and image retrieval.

[0195] In this way, when an electronic device uses an index to store an image to be stored, it can first obtain an image storage request that includes the image to be stored, the image features of the image to be stored, and the target scene identifier of the target application scene to which the image to be stored belongs.

[0196] S302: Determine the target index corresponding to the target scene identifier;

[0197] The target index is constructed according to an index creation method provided in the above embodiments of the present invention.

[0198] After obtaining the image storage request, the target scene identifier of the target application scene to which the image to be stored belongs can be used to determine the target index corresponding to the target scene identifier.

[0199] Optionally, a correspondence between scene identifiers and indexes can be established in advance. Thus, after obtaining an image storage request, the target scene identifier of the target application scene to which the image to be stored belongs in the image storage request can be used to determine the target index corresponding to the target scene identifier based on the pre-established correspondence between scene identifiers and indexes.

[0200] Optionally, the aforementioned correspondence between scene identifiers and indexes can be stored in a table. Thus, after obtaining an image storage request, the target scene identifier of the target application scene to which the image to be stored belongs can be used in the image storage request. The index corresponding to the target scene identifier can then be selected from the pre-established table of correspondence between scene identifiers and indexes as the target index. For example, Table 1 shows a partial table of the correspondence between scene identifiers and indexes.

[0201] Table 1

[0202] Scene identifier index X 1 Z 2

[0203] Thus, when the target scene identifier of the target application scenario to which the image to be stored belongs in the image storage request is determined to be: Scene Identifier: X, the target index corresponding to the target scene identifier is determined to be: Index 1 in the pre-established table of the correspondence between scene identifiers and indexes; when the target scene identifier of the target application scenario to which the image to be stored belongs in the image storage request is determined to be: Scene Identifier: Z, the target index corresponding to the target scene identifier is determined to be: Index 2 in the pre-established table of the correspondence between scene identifiers and indexes.

[0204] S303: Generate an image identifier for the image to be stored, and based on the image identifier, determine the target storage fragment to respond to the image storage request in each storage fragment corresponding to the target index.

[0205] To facilitate storage, the management node in the ES cluster can generate an image identifier for the image to be stored. Based on the image identifier, the target storage shard for responding to the image storage request can be determined in each storage shard corresponding to the determined target index.

[0206] Optionally, the Elasticsearch (ES) cluster can be a decentralized cluster, where any storage node can act as both a management node and a functional node for storage and retrieval. Therefore, the management node can be any node in the ES cluster that needs to be retrieved.

[0207] S304: Send the image storage request and image identifier to the target node to which the target storage segment belongs, so that the target node stores the image to be stored, image features and image identifier in the target storage segment.

[0208] After determining the target storage shard for responding to the image storage request based on the generated image identifier of the image to be stored, the target node to which the target storage shard belongs can be determined. Thus, the management node in the ES cluster can send the image storage request and the image identifier to the target node, so that the target node stores the image to be stored, the image features of the image to be stored, and the generated image identifier of the image to be stored in the image storage request in the target storage shard.

[0209] Based on this, by applying the solution provided in this embodiment of the invention, an image storage request can be sent to the management node in the ES cluster. This request includes the image to be stored, the image features of the image to be stored, and the target scene identifier of the target application scene to which the image to be stored belongs. The management node then uses the image identifier generated based on the image features of the image to be stored to determine the target storage shard for responding to the image storage request in the target index corresponding to the target scene. Thus, the image storage request and the image identifier can be sent to the target node to which the target storage shard belongs, so that the target node stores the image to be stored, the image features, and the image identifier in the target storage shard. This allows the image to be stored based on the constructed index, thereby improving the efficiency of image storage.

[0210] To improve the disaster recovery capability of electronic devices, at least one backup shard can be configured for each storage shard. In this way, when a storage shard fails, the backup shard can be used to continue executing tasks, thereby improving the stability of electronic devices in performing tasks.

[0211] Based on this, in one optional implementation, such as Figure 4 The diagram shown is a flowchart of an image storage method provided by an embodiment of the present invention. When each storage shard is associated with at least one backup shard, the image storage method provided by the embodiment of the present invention may further include the following step S401:

[0212] S401: Send the image storage request and image identifier to the target backup node to which the target backup partition belongs, so that the target backup node stores the image to be stored, image features and image identifier in the target backup partition.

[0213] For each storage shard, the storage shard and at least one backup shard associated with it belong to different storage nodes.

[0214] In this specific implementation, when each storage shard is associated with at least one backup shard, after the management node determines the target storage shard for responding to the image storage request based on the generated image identifier of the image to be stored, it can send the image storage request and the image identifier to the target backup node to which the target backup shard associated with the target storage shard belongs, so that the target backup node stores the image to be stored, the image features of the image to be stored, and the generated image identifier of the image to be stored in the image storage request in the target backup shard.

[0215] In this way, if the target storage shard fails, the image storage process can continue using the target backup shard, thereby improving the stability of image storage.

[0216] Optionally, in one specific implementation, step S303 above, which involves determining the target storage partition for responding to the image storage request based on the image identifier among the storage partitions corresponding to the target index, may include the following step 44:

[0217] Step 44: Using the third formula, determine the target storage fragment to respond to the image storage request; whereby the third formula is expressed as:

[0218]

[0219] in, The fragment identifier for the target storage fragment. For image identification, To obtain the hash value of the ID determined using a hash algorithm, The number of storage shards corresponding to the target index. The remainder is calculated by taking the hash value of the ID determined by the hash algorithm and dividing it by the number of storage fragments corresponding to the target index.

[0220] In other words, the remainder of the hash value of the ID determined by the hash algorithm divided by the number of storage fragments corresponding to the target index is used as the fragment identifier of the target storage fragment.

[0221] The image labels can be generated by an Elasticsearch cluster or manually labeled. This embodiment of the invention does not impose specific limitations on this.

[0222] and, When sufficiently discrete, each data segment can be evenly distributed.

[0223] In this specific implementation, a fragment identifier can be set in advance for each storage fragment. In this way, the fragment identifier of the target storage fragment used to respond to the above image storage request can be determined based on the image identifier using the third formula.

[0224] For example, if the image identifier ID is α, Given the number of storage fragments corresponding to the target index, the target storage fragments used to respond to image storage requests are determined using the third formula: .

[0225] Corresponding to the index creation method provided in the above embodiments of the present invention, the present invention provides an image retrieval method, which is applied to the management node in an ES cluster.

[0226] Figure 5 This is a flowchart illustrating an image retrieval method provided in an embodiment of the present invention, as shown below. Figure 5 As shown, the method includes the following steps S501-S504.

[0227] S501: Obtain an image retrieval request; wherein, the image retrieval request includes the image features to be retrieved and the retrieval scene identifier of the application scene to which the image belongs;

[0228] The purpose of stored images varies depending on the application scenario. For example, a physical store can use electronic devices to capture and store images of customers entering the store for better customer management. Similarly, security guards can use electronic devices to capture and store images of people entering the store to ensure the safety of residents in case of suspicious individuals.

[0229] Therefore, for image storage in different application scenarios, a target scene identifier of the target application scenario can be added to the image to be stored, so as to classify and categorize the images stored in the storage space, thereby improving the efficiency of image storage and image retrieval.

[0230] In this way, when an electronic device uses the index to search for an image, it can first obtain an image search request that includes the image features to be searched and the search scene identifier of the application scene to which the image belongs.

[0231] S502: Determine the index to be searched corresponding to the scene identifier to be searched;

[0232] The index to be retrieved is constructed using an index creation method provided in an embodiment of the present invention.

[0233] After obtaining the image retrieval request, the retrieval scene identifier of the retrieval application scene to which the image to be retrieved belongs in the above image retrieval request can be used to determine the retrieval index corresponding to the retrieval scene identifier.

[0234] The specific implementation of step S502 is similar to that of step S203, and will not be repeated here.

[0235] S503: Send the image retrieval request to the retrieval node to which each retrieval storage segment corresponding to the retrieval index belongs, so that after receiving the image retrieval request, each retrieval node performs image retrieval in the retrieval storage segment included in each retrieval node according to the image features of the image to be retrieved, and feeds back the obtained retrieval results to the management node.

[0236] After determining the search index corresponding to the above-mentioned search scene identifier, the management node can send the above-mentioned image search request to the search nodes to which each search storage shard belongs to the above-mentioned search index. Thus, after receiving the above-mentioned image search request, each search node can perform image search in the search storage shards included in each search node according to the search image features in the above-mentioned image search request, and after obtaining the search results, feed back the obtained search results to the above-mentioned management node.

[0237] Optionally, the Elasticsearch (ES) cluster can be a decentralized cluster, whereby any storage node in the ES cluster can act as both a management node and a functional node for storage and retrieval. Therefore, the aforementioned management node can be any node in the ES cluster that needs to be retrieved.

[0238] Optionally, in one specific implementation, step S503 above, which involves performing image retrieval in the storage segments to be retrieved within each node to be retrieved based on the image features of the image to be retrieved, may include the following step 5031:

[0239] Step 5031: For each storage segment to be retrieved included in each node to be retrieved, calculate the feature similarity between the image features of the image to be retrieved and the image features of each image in the storage segment to be retrieved, and obtain the retrieval results for the node to be retrieved.

[0240] In this specific implementation, after determining the search index corresponding to the above-mentioned search scene identifier, the management node can send the above-mentioned image search request to the search nodes to which each search storage segment corresponding to the above-mentioned search index belongs. Thus, after receiving the above-mentioned image search request, each search node can perform image search for each search storage segment included in each search node, and when using the search image features in the above-mentioned image search request, calculate the similarity score between the image features of the search image and the image features of each image in the search storage segment. If the calculated similarity score between the image features of the image and the image features of the search image exceeds a preset score, then the image is determined as the search result.

[0241] Optionally, if the target object is too far from the image acquisition device, or the acquisition parameters of the image acquisition device are not suitable for the application scenario, resulting in unclear or blurry images to be retrieved, a pre-set confidence level for the image features can be set. Before performing image retrieval in the retrieval storage segments included in each retrieval node based on the image features of the image to be retrieved, it can be determined whether the confidence level of the image features of the image to be retrieved reaches the pre-set confidence level. If it does, image retrieval can be performed in the retrieval storage segments included in each retrieval node based on the image features of the image to be retrieved. Otherwise, a prompt message can be provided to ensure that the retrieval cannot be performed due to the low confidence level of the image features of the image to be retrieved.

[0242] S504: Obtain the search results from each node to be searched, and determine the target response result for the image search request based on the obtained search results.

[0243] After obtaining the search results from each node to be searched, the management node can determine the target response result for the above image search request based on the obtained search results.

[0244] Optionally, in one specific implementation, the search results returned by each node to be searched include: a priority queue containing multiple entries;

[0245] The entries are arranged in descending order of the similarity of the included features. Each entry corresponds to an image in the storage segment to be retrieved included in the node to be retrieved. Each entry includes: the image corresponding to the entry, the feature similarity between the image features of the image corresponding to the entry and the image features of the image to be retrieved, and the image identifier of the image corresponding to the entry.

[0246] In this specific implementation, for each node to be searched, if the various storage fragments included in the node to be searched return multiple search results, a priority queue of multiple entries can be pre-established in the node to be searched. Each entry corresponds to an image in the storage fragments included in the node to be searched, and each entry includes: the image corresponding to the entry, the feature similarity between the image features of the image corresponding to the entry and the image features of the image to be searched, and the image identifier of the image corresponding to the entry. Thus, the entries can be arranged in descending order of the included feature similarity.

[0247] For example, the management node is node A, and the node to be searched is node R, where node R includes storage shards r1 and r2. Based on the features of the image to be searched, image retrieval is performed in storage shard r1, yielding retrieval result 1 and retrieval result 2; image retrieval is performed in storage shard r2, yielding retrieval result 3 and retrieval result 4. The feature similarity of retrieval result 1 is 80%, that of retrieval result 2 is 75%, that of retrieval result 3 is 77%, and that of retrieval result 4 is 70%. Therefore, arranging retrieval result 1, retrieval result 2, retrieval result 3, and retrieval result 4 in descending order of feature similarity results results in the following priority queue: retrieval result 1, retrieval result 2, retrieval result 4, and retrieval result 3.

[0248] To facilitate the management node in obtaining the target response results of image retrieval requests, thereby improving the efficiency of image retrieval.

[0249] Optionally, in one specific implementation, step S504 above, the step of determining the target response result of the image retrieval request based on the obtained retrieval results, may include the following step 55:

[0250] Step 55: Arrange the entries in the obtained search results in descending order of feature similarity, and determine the images included in the entries arranged before the preset position as the target response results of the image retrieval request.

[0251] In this specific implementation, after the management node obtains the search results fed back by each node to be searched, it can arrange each item in the obtained search results according to the order of feature similarity of the items corresponding to each search result from high to low. Thus, after determining the order of the search results fed back by each node to be searched, the images included in the items arranged before the preset position are determined as the target response results of the above image search request.

[0252] For example, if the preset position is 2, after the management node obtains the search results from each node to be searched, the order obtained by arranging them in descending order of feature similarity is: search result 1, search result 2, search result 4 and search result 3. Then, the image included in the entry corresponding to search result 1 can be determined as the target response result of the above image search request.

[0253] Based on this, by applying the solution provided in this embodiment of the invention, an image retrieval request can be sent to the management node in the ES cluster. This request includes the image features to be retrieved and the scene identifier of the application scene to which the image belongs. The management node then sends the image retrieval request to the respective storage shards corresponding to the target scene based on the retrieval index. This allows each retrieval node to perform image retrieval within its respective storage shard. Furthermore, based on the retrieval results returned by each retrieval node, the target response result of the image retrieval request is determined. This further enables image retrieval based on the constructed index, improving the efficiency of image retrieval.

[0254] Because each target image can be stored along with its associated additional information, when retrieving the target image, the associated additional information, such as ID card number or membership level, can be obtained.

[0255] Optionally, in one specific implementation, the image retrieval method provided in this embodiment of the invention may further include the following step 66:

[0256] Step 66: In the preset information storage space, obtain the additional information associated with each target image in the target response result.

[0257] To improve the user experience, information storage space can be pre-set. When storing each target image, the corresponding additional information associated with each target image is also stored. Thus, when the management node obtains the target response result, it can retrieve the additional information associated with each target image in the target response result from the pre-set information storage space.

[0258] Optionally, in one specific implementation, the image retrieval method provided in this embodiment of the invention may further include the following step 77:

[0259] Step 77: Output the target response result.

[0260] After obtaining the target response result of the above image retrieval request, the target response result can be output so that the user can obtain the target response result corresponding to the above image retrieval request.

[0261] Optionally, output the target response result and any additional information associated with that target response result.

[0262] In some cases, the management node may receive multiple image retrieval requests that include the identifier of the scene to be retrieved. Therefore, each image retrieval request can be sent to the corresponding target shard to be retrieved node in a preset order, thereby improving the efficiency of image retrieval.

[0263] Based on this, optionally, in one specific implementation, each storage shard to be retrieved is associated with at least one backup shard to be retrieved; when multiple image retrieval requests including the scene identifier to be retrieved are obtained, the above step S503 may include the following step 5032:

[0264] Step 5032: Starting from the first image retrieval request, each image retrieval request is sent sequentially to the target retrieval node corresponding to a set of target shards of the retrieval index according to the preset polling order, so that each retrieval node, after receiving the image retrieval request, performs image retrieval in the retrieval storage shards included in each retrieval node according to the image features of the image to be retrieved.

[0265] Each target shard group includes: all storage shards to be retrieved, or one backup shard to be retrieved associated with each of the storage shards to be retrieved.

[0266] In this specific implementation, each storage shard to be retrieved is associated with at least one backup shard to be retrieved. Therefore, when multiple image retrieval requests containing the identifier of the scene to be retrieved are received, the management node can, starting from the first image retrieval request, send each image retrieval request sequentially to the retrieval nodes belonging to the set of target shards corresponding to the retrieval index, according to a preset polling order. This allows each retrieval node, upon receiving the image retrieval request, to perform image retrieval within the storage shards included in each retrieval node, based on the image features of the image to be retrieved.

[0267] In this way, when the management node receives multiple image retrieval requests that include the identifier of the scene to be retrieved, it can use multiple retrieval nodes belonging to a set of target shards corresponding to the retrieval index to perform image retrieval in parallel, thereby improving the efficiency of image retrieval.

[0268] To facilitate understanding of step S503 above, the image retrieval request is sent to the retrieval nodes corresponding to each retrieval storage segment of the retrieval index. This allows each retrieval node, upon receiving the image retrieval request, to perform an image retrieval within its respective retrieval storage segment based on the image features of the image to be retrieved, and then feed back the retrieval results to the management node. For example, taking a face retrieval request as an example... Figure 6 The diagram shown is a flowchart of a specific embodiment of the present invention.

[0269] When the coordinating node Nx receives a retrieval request, it first establishes a priority queue to record each retrieval result. Then, it broadcasts the retrieval request to each shard of the index in a round-robin manner, thereby reducing the task pressure on each node in the ES cluster.

[0270] After receiving a request to perform a retrieval on one or more shards P, node Ny can calculate the workload of performing the retrieval request on each shard P.

[0271] When shard P executes a retrieval request, it first initializes a face scoring script. Then, it creates a priority queue to store the shard's retrieval results. Following the query filtering in the retrieval request, it performs document filtering and image retrieval for shard P. During image retrieval, shard P executes the face scoring script for each filtered document, thereby obtaining the face features fn in the document. It then calculates the similarity score between the face features fn in the document and the face features f0 in the request, using this score as the document's relevance score in the retrieval request. Shard P then places all the obtained document scores into the priority queue created for that shard, arranges the scores in descending order, and feeds back the TOPN results to the coordinating node Nx.

[0272] The coordinating node Nx aggregates the results fed back by each node in the manner described above for the shard P, and uses the retrieved document, that is, the document details obtained at the node where the shard corresponding to the above search request is located, as the response result of the above search request.

[0273] Corresponding to the index creation method provided in the above embodiments of the present invention, the present invention provides an index creation apparatus.

[0274] Figure 7 This is a schematic diagram of the structure of an index creation device provided in an embodiment of the present invention, as shown below. Figure 7 As shown, the device may include the following modules:

[0275] The second quantity determination module 710 is used to determine the second quantity of storage shards for storing images in a specified application scenario based on the first quantity of storage nodes in the ES cluster.

[0276] The index creation module 720 is used to send an index creation request carrying the second number to the management node in the ES cluster, so that after receiving the index creation request, the management node determines the storage shard corresponding to each storage node in the ES cluster based on the second number, creates the specified index corresponding to the specified application scenario, and creates the storage shard corresponding to the specified index in each storage node.

[0277] As can be seen from the above, when building an index based on Elasticsearch using the solution provided in the embodiments of the present invention, firstly, a second number of storage shards for storing images in a specified application scenario can be determined based on a first number of storage nodes in the Elasticsearch cluster. Then, an index creation request carrying the second number can be sent to the management node in the Elasticsearch cluster. After receiving the index creation request, the management node determines the storage shards corresponding to each storage node in the Elasticsearch cluster based on the second number, creates a specified index corresponding to the specified application scenario, and creates storage shards corresponding to the specified index in each storage node.

[0278] Based on this, by applying the solution provided in the embodiments of the present invention, an index creation request carrying a second number of storage shards for storing images in a specified application scenario can be sent to the management node in the ES cluster. This allows the management node to create a specified index corresponding to the specified application scenario based on the index creation request, and to create storage shards corresponding to the specified index in each storage node. Thus, when performing image storage and image retrieval, the constructed index can be used for storage and retrieval, thereby improving the efficiency of image storage and image retrieval.

[0279] Optionally, in one specific implementation, the apparatus further includes:

[0280] The backup sharding module is used to determine the backup shards corresponding to each storage node in the ES cluster based on the second quantity and the third quantity of backup shards associated with each preset storage shard.

[0281] The index creation module 720 is specifically used for:

[0282] Send an index creation request carrying the second number to the management node in the ES cluster, so that after receiving the index creation request, the management node determines the storage shard corresponding to each storage node in the ES cluster based on the second number, creates the specified index corresponding to the specified application scenario, and creates the storage shard and backup shard corresponding to the specified index in each storage node.

[0283] Optionally, in one specific implementation, the index creation module 720 is specifically used for:

[0284] If the second quantity meets the preset conditions, then the storage shard corresponding to each storage node in the ES cluster is determined.

[0285] Optionally, in one specific implementation, the second quantity determination module 710 is specifically used for:

[0286] Using the first formula, a second number of storage fragments for storing images in a specified application scenario is determined; wherein, the first formula is:

[0287] ;

[0288] in, For the second quantity, The number of backup shards associated with each storage shard. For the first quantity, It is a fixed constant.

[0289] Optionally, in one specific implementation, the index creation module 720 is specifically used for:

[0290] If the second quantity satisfies the second formula, then the storage shard corresponding to each storage node in the ES cluster is determined; wherein, the second formula is:

[0291] .

[0292] Corresponding to the image storage method provided in the above embodiments of the present invention, the present invention provides an image storage device.

[0293] Figure 8 This is a schematic diagram of the structure of an image storage device provided in an embodiment of the present invention, as shown below. Figure 8 As shown, the device may include the following modules:

[0294] Image storage request module 810 is used to obtain an image storage request; wherein, the image storage request includes an image to be stored, image features of the image to be stored, and a target scene identifier of the target application scene to which the image to be stored belongs;

[0295] The target index determination module 820 is used to determine the target index corresponding to the target scene identifier; wherein, the target index is constructed by an index creation method provided according to an embodiment of the present invention;

[0296] The target storage fragment determination module 830 is used to generate an image identifier for the image to be stored, and based on the image identifier, determine the target storage fragment for responding to the image storage request in each storage fragment corresponding to the target index;

[0297] The target storage shard storage module 840 is used to send the image storage request and the image identifier to the target node to which the target storage shard belongs, so that the target node stores the image to be stored, the image features and the image identifier in the target storage shard.

[0298] Based on this, by applying the solution provided in this embodiment of the invention, an image storage request can be sent to the management node in the ES cluster. This request includes the image to be stored, the image features of the image to be stored, and the target scene identifier of the target application scene to which the image to be stored belongs. The management node then uses the image identifier generated based on the image features of the image to be stored to determine the target storage shard for responding to the image storage request in the target index corresponding to the target scene. Thus, the image storage request and the image identifier can be sent to the target node to which the target storage shard belongs, so that the target node stores the image to be stored, the image features, and the image identifier in the target storage shard. This allows the image to be stored based on the constructed index, thereby improving the efficiency of image storage.

[0299] Optionally, in one specific implementation, each storage shard is associated with at least one backup shard, and the apparatus further includes:

[0300] The backup shard storage module is used to send the image storage request and the image identifier to the target backup node to which the target backup shard associated with the target storage shard belongs, so that the target backup node stores the image to be stored, the image features and the image identifier in the target backup shard accordingly;

[0301] For each storage shard, the storage shard and at least one backup shard associated with it belong to different storage nodes.

[0302] Optionally, in one specific implementation, the target storage fragment determination module 830 is specifically used for:

[0303] The target storage fragment for responding to the image storage request is determined using the third formula; wherein the third formula is expressed as:

[0304]

[0305] in, The fragment identifier for the target storage fragment. For the image identifier, The hash value of the ID determined using a hash algorithm, This refers to the number of storage shards corresponding to the target index.

[0306] Corresponding to the image retrieval method provided in the embodiments of the present invention, the embodiments of the present invention provide an image retrieval device.

[0307] Figure 9 This is a schematic diagram of the structure of an image retrieval device provided in an embodiment of the present invention, as shown below. Figure 9 As shown, the device may include the following modules:

[0308] The image retrieval request module 910 is used to obtain an image retrieval request; wherein, the image retrieval request includes the image features to be retrieved and the retrieval scene identifier of the application scene to which the image to be retrieved belongs;

[0309] The index to be retrieved determination module 920 is used to determine the index to be retrieved corresponding to the scene identifier to be retrieved; wherein, the index to be retrieved is constructed by an index creation method provided according to an embodiment of the present invention;

[0310] The retrieval result acquisition module 930 is used to send the image retrieval request to the retrieval node to which each retrieval storage segment corresponding to the retrieval index belongs, so that after receiving the image retrieval request, each retrieval node performs image retrieval in the retrieval storage segment included in each retrieval node according to the image features of the image to be retrieved, and feeds back the obtained retrieval results to the management node.

[0311] The target response result acquisition module 940 is used to acquire the search results fed back by each node to be searched, and determine the target response result of the image search request based on the acquired search results.

[0312] Based on this, by applying the solution provided in this embodiment of the invention, an image retrieval request can be sent to the management node in the ES cluster. This request includes the image features to be retrieved and the scene identifier of the application scene to which the image belongs. The management node then sends the image retrieval request to the respective storage shards corresponding to the target scene based on the retrieval index. This allows each retrieval node to perform image retrieval within its respective storage shard. Furthermore, based on the retrieval results returned by each retrieval node, the target response result of the image retrieval request is determined. This further enables image retrieval based on the constructed index, improving the efficiency of image retrieval.

[0313] Optionally, in one specific implementation, the retrieval result acquisition module 930 is specifically used for:

[0314] For each storage segment to be retrieved that includes each node to be retrieved, the feature similarity between the image features of the image to be retrieved and the image features of each image in the storage segment to be retrieved is calculated to obtain the retrieval results for the node to be retrieved.

[0315] Optionally, in one specific implementation, the search results returned by each node to be searched include:

[0316] The priority queue includes multiple entries; wherein each entry is arranged in descending order of the included feature similarity, each entry corresponds to an image in the storage segment to be retrieved included in the node to be retrieved, and each entry includes: the image corresponding to the entry, the feature similarity between the image features of the image corresponding to the entry and the image features of the image to be retrieved, and the image identifier of the image corresponding to the entry.

[0317] Optionally, in one specific implementation, the target response result acquisition module 940 is specifically used for:

[0318] Arrange the entries in the obtained search results in descending order of feature similarity, and determine the images included in the entries arranged before the preset position as the target response results of the image retrieval request.

[0319] Optionally, in one specific implementation, the apparatus further includes:

[0320] The additional information acquisition module is used to acquire additional information associated with each target image in the target response result from a preset information storage space.

[0321] Optionally, in one specific implementation, the apparatus further includes:

[0322] The output module is used to output the target response result.

[0323] Optionally, in one specific implementation, each storage shard to be retrieved is associated with at least one backup shard to be retrieved; when multiple image retrieval requests including the scene identifier to be retrieved are obtained, the retrieval result acquisition module 930 is specifically used for:

[0324] Starting with the first image retrieval request, each image retrieval request is sent sequentially to the target retrieval node corresponding to a set of target shards of the index to be retrieved, according to a preset polling order. This allows each target retrieval node to perform image retrieval in the included target shards based on the image features of the image to be retrieved after receiving the image retrieval request.

[0325] Each target shard group includes: all storage shards to be retrieved, or one backup shard to be retrieved associated with each of the storage shards to be retrieved.

[0326] Corresponding to the index creation method, image storage method, and image retrieval method provided in the above embodiments of the present invention, the present invention also provides an electronic device, such as... Figure 10 As shown, it includes a processor 1001, a communication interface 1002, a memory 1003, and a communication bus 1004, wherein the processor 1001, the communication interface 1002, and the memory 1003 communicate with each other through the communication bus 1004.

[0327] Memory 1003 is used to store computer programs;

[0328] When the processor 1001 executes the program stored in the memory 1003, it implements the steps of any of the index creation methods provided in the above embodiments of the present invention.

[0329] Corresponding to the index creation method, image storage method, and image retrieval method provided in the above embodiments of the present invention, the present invention also provides an electronic device, such as... Figure 11 As shown, it includes a processor 1101, a communication interface 1102, a memory 1103, and a communication bus 1104. The processor 1101, communication interface 1102, and memory 1103 communicate with each other via the communication bus 1104.

[0330] Memory 1103 is used to store computer programs;

[0331] When the processor 1101 executes the program stored in the memory 1103, it implements the steps of any of the image storage methods provided in the above embodiments of the present invention, and / or the steps of any of the image retrieval methods provided in the above embodiments of the present invention.

[0332] The communication bus mentioned in the above electronic devices can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in the diagram, but this does not mean that there is only one bus or one type of bus.

[0333] The communication interface is used for communication between the aforementioned electronic devices and other devices.

[0334] The memory may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.

[0335] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.

[0336] In another embodiment of the present invention, a computer-readable storage medium is also provided, which stores a computer program that, when executed by a processor, implements the steps of any of the index creation methods provided in the embodiments of the present invention.

[0337] In another embodiment of the present invention, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to perform the steps of any of the image storage methods in the above embodiments of the present invention, and / or the steps of any of the image retrieval methods provided in the above embodiments of the present invention.

[0338] In another embodiment of the present invention, a computer-readable storage medium is also provided, which stores a computer program that, when executed by a processor, implements the steps of any of the index creation methods provided in the embodiments of the present invention.

[0339] In another embodiment of the present invention, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to perform the steps of any of the image storage methods provided in the above embodiments of the present invention, and / or the steps of any of the image retrieval methods provided in the above embodiments of the present invention.

[0340] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present invention are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium accessible to a computer or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state disk (SSD)).

[0341] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0342] The various embodiments in this specification are described in a related manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the device embodiments, electronic device embodiments, computer-readable storage medium embodiments, and computer program product embodiments are basically similar to the method embodiments, so the descriptions are relatively simple; relevant parts can be referred to the descriptions of the method embodiments.

[0343] The above description is merely a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention are included within the scope of protection of the present invention.

Claims

1. An index creation method, characterized in that, The method includes: Using the first formula, a second number of storage fragments for storing images in a specified application scenario is determined; wherein, the first formula is: ;in, For the second quantity, The number of backup shards associated with each storage shard. This represents the initial number of storage nodes in the Elasticsearch cluster. It is a fixed constant; An index creation request carrying the second quantity is sent to the management node in the ES cluster. Upon receiving the index creation request, if the second quantity satisfies a second formula, the management node determines the storage shard corresponding to each storage node in the ES cluster. The second formula is: % represents the modulo operation, and a specified index corresponding to the specified application scenario is created, and a storage shard corresponding to the specified index is created in each storage node.

2. The method according to claim 1, characterized in that, The method further includes: Based on the second quantity and the third quantity of backup fragments associated with each storage fragment, the backup fragments corresponding to each storage node in the ES cluster are determined. Sending index creation requests carrying the second number to the management node in the ES cluster, so that after receiving the index creation requests, the management node determines the storage shard corresponding to each storage node in the ES cluster based on the second number, creates the specified index corresponding to the specified application scenario, and creates the storage shard corresponding to the specified index in each storage node, includes: Send an index creation request carrying the second number to the management node in the ES cluster, so that after receiving the index creation request, the management node determines the storage shard and backup shard corresponding to each storage node in the ES cluster based on the second number, creates the specified index corresponding to the specified application scenario, and creates the storage shard and backup shard corresponding to the specified index in each storage node.

3. An image storage method, characterized in that, The method, applied to the management node in an Elasticsearch cluster, includes: Obtain an image storage request; wherein, the image storage request includes an image to be stored, image features of the image to be stored, and a target scene identifier of the target application scene to which the image to be stored belongs; Determine the target index corresponding to the target scene identifier; wherein the target index is constructed according to the method described in claim 1 or 2; Generate an image identifier for the image to be stored, and based on the image identifier, determine the target storage segment for responding to the image storage request in each storage segment corresponding to the target index; The image storage request and the image identifier are sent to the target node to which the target storage segment belongs, so that the target node stores the image to be stored, the image features, and the image identifier in the target storage segment.

4. The method according to claim 3, characterized in that, Each storage shard is associated with at least one backup shard, and the method further includes: The image storage request and the image identifier are sent to the target backup node to which the target backup partition associated with the target storage partition belongs, so that the target backup node stores the image to be stored, the image features, and the image identifier in the target backup partition. For each storage shard, the storage shard and at least one backup shard associated with it belong to different storage nodes.

5. The method according to claim 3 or 4, characterized in that, The step of determining the target storage partition for responding to the image storage request in each storage partition corresponding to the target index based on the image identifier includes: The target storage fragment for responding to the image storage request is determined using the third formula; wherein the third formula is expressed as: ; in, The fragment identifier for the target storage fragment. For the image identifier, The hash value of the ID determined using a hash algorithm, The value represents the number of storage shards corresponding to the target index, with % indicating the modulo operation.

6. An image retrieval method, characterized in that, The method, applied to the management node in an Elasticsearch cluster, includes: Obtain an image retrieval request; wherein, the image retrieval request includes the image features to be retrieved and the retrieval scene identifier of the application scene to which the image to be retrieved belongs; Determine the search index corresponding to the search scene identifier; wherein the search index is constructed according to the method according to claim 1 or 2; The image retrieval request is sent to the retrieval nodes to which each retrieval storage shard belongs, corresponding to the retrieval index. After receiving the image retrieval request, each retrieval node performs an image retrieval in the retrieval storage shard included in each retrieval node according to the image features of the image to be retrieved, and feeds back the retrieval results to the management node. Obtain the search results from each node to be searched, and determine the target response result of the image search request based on the obtained search results.

7. The method according to claim 6, characterized in that, The step of performing image retrieval based on the image features of the image to be retrieved in the storage segments to be retrieved included in each node to be retrieved includes: For each storage segment to be retrieved that includes each node to be retrieved, the feature similarity between the image features of the image to be retrieved and the image features of each image in the storage segment to be retrieved is calculated to obtain the retrieval results for the node to be retrieved.

8. The method according to claim 7, characterized in that, The search results returned by each node to be searched include: The priority queue includes multiple entries; wherein each entry is arranged in descending order of the included feature similarity, each entry corresponds to an image in the storage segment to be retrieved included in the node to be retrieved, and each entry includes: the image corresponding to the entry, the feature similarity between the image features of the image corresponding to the entry and the image features of the image to be retrieved, and the image identifier of the image corresponding to the entry.

9. The method according to claim 8, characterized in that, Determining the target response result for the image retrieval request based on the acquired retrieval results includes: Arrange the entries in the obtained search results in descending order of feature similarity, and determine the images included in the entries arranged before the preset position as the target response results of the image retrieval request.

10. The method according to any one of claims 6-9, characterized in that, The method further includes: In the preset information storage space, additional information associated with each target image in the target response result is obtained.

11. The method according to any one of claims 6-9, characterized in that, The method further includes: Output the target response result.

12. The method according to claim 6, characterized in that, Each storage shard to be retrieved is associated with at least one backup shard to be retrieved; When multiple image retrieval requests including the scene identifier to be retrieved are received, the step of sending the image retrieval requests to the retrieval nodes belonging to each retrieval storage shard corresponding to the retrieval index, so that each retrieval node, upon receiving the image retrieval request, performs image retrieval within the included retrieval storage shard based on the image features of the image to be retrieved, includes: Starting with the first image retrieval request, each image retrieval request is sent sequentially to the target retrieval node corresponding to a set of target shards of the index to be retrieved, according to a preset polling order. This allows each target retrieval node to perform image retrieval in the included target shards based on the image features of the image to be retrieved after receiving the image retrieval request. Each target shard group includes: all storage shards to be retrieved, or one backup shard to be retrieved associated with each of the storage shards to be retrieved.

13. An index creation apparatus, characterized in that, The device includes: The second quantity determination module is specifically used to determine, using a first formula, the second quantity of storage slices for storing images in a specified application scenario; wherein, the first formula is: Where P is the second quantity, r is the number of backup shards associated with each storage shard, n is the first number of storage nodes in the ES cluster, and Y is a fixed constant. The index creation module is used to send an index creation request carrying the second quantity to the management node in the ES cluster, so that after receiving the index creation request, the management node determines the storage shard corresponding to each storage node in the ES cluster if the second quantity satisfies the second formula; the second formula is: % represents the modulo operation, and a specified index corresponding to the specified application scenario is created, and a storage shard corresponding to the specified index is created in each storage node.

14. An image storage device, characterized in that, The device, used as a management node in an ES cluster, includes: An image storage request module is used to obtain an image storage request; wherein, the image storage request includes an image to be stored, image features of the image to be stored, and a target scene identifier of the target application scene to which the image to be stored belongs; A target index determination module is used to determine the target index corresponding to the target scene identifier; wherein the target index is constructed according to the method described in claim 1 or 2; The target storage fragment determination module is used to generate an image identifier for the image to be stored, and based on the image identifier, determine the target storage fragment for responding to the image storage request in each storage fragment corresponding to the target index; The target storage shard storage module is used to send the image storage request and the image identifier to the target node to which the target storage shard belongs, so that the target node stores the image to be stored, the image features, and the image identifier in the target storage shard.

15. An image retrieval device, characterized in that, The device, used as a management node in an ES cluster, includes: An image retrieval request module is used to obtain an image retrieval request; wherein, the image retrieval request includes the image features to be retrieved and the retrieval scene identifier of the application scene to which the image to be retrieved belongs; The index to be retrieved module is used to determine the index to be retrieved corresponding to the scenario identifier to be retrieved; wherein the index to be retrieved is constructed according to the method according to claim 1 or 2; The search result acquisition module is used to send the image search request to the search nodes to which each search storage segment corresponding to the search index belongs, so that each search node, after receiving the image search request, performs image search in the search storage segment included in each search node according to the image features of the image to be searched, and feeds back the obtained search results to the management node. The target response result acquisition module is used to acquire the search results fed back by each node to be searched, and determine the target response result of the image search request based on the acquired search results.

16. An electronic device, characterized in that, It includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, when executing a program stored in memory, implements the steps of the method described in claim 1 or 2.

17. An electronic device, characterized in that, It includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; Memory, used to store computer programs; When executing a program stored in memory, the processor implements the method steps of any one of claims 3-5, and / or the method steps of any one of claims 6-12.

18. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the method described in claim 1 or 2.

19. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the method according to any one of claims 3-5, and / or the steps of the method according to any one of claims 6-12.