An object recognition method, apparatus and electronic device
Patent Information
- Application Number
- CN202310703289.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-13
- Publication Date
- 2026-10-09
- Estimated Expiration
- 2043-06-13
AI Technical Summary
由于分类模型的训练周期较长,将导致轮毂识别的效率较低,甚至可以因为模型的重新训练而导致轮毂识别中断
[0060]As can be seen from the above, by applying the solution provided in the embodiments of this application, for the identified object type, a preset feature extraction model can be used to extract image features of objects belonging to each preset type of the object type, and preset association information between each preset type of the object type and the image features of objects belonging to each preset type can be established. Thus, when identifying an object belonging to the object type, the image of the object to be identified can be obtained, and the obtained image can be input into the aforementioned feature extraction model to obtain the target image features of the object to be identified output by the feature extraction model. Then, the similarity between the target image features and the image features associated with each preset type in the aforementioned preset association information can be calculated, and based on the calculated similarities, the type identification result of the object to be identified can be determined.
Smart Images

Figure CN116758524B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and in particular to an object recognition method, apparatus and electronic device. Background Technology
[0002] With economic development, automobiles have become one of the most important means of transportation. As a crucial component of automobiles, the production of wheels is a vital part of the overall automotive manufacturing process, and identifying the model numbers of wheels on the production line is a key aspect of this process.
[0003] In related technologies, for each wheel hub model, multiple sample images of wheel hubs belonging to that model can be acquired. Then, a classification model is trained using each wheel hub sample image with a wheel hub model label. In this way, when recognizing images related to wheel hubs, the image to be recognized can be input into the above classification model, and the wheel hub model of the wheel hub in the image to be recognized can be obtained from the output of the classification model.
[0004] However, in related technologies, because the classification model is trained using image features of various wheel rim models, it can only identify wheel rims belonging to the same model within the sample images, and cannot identify new wheel rim models. To identify new wheel rim models, multiple images of those new models need to be used as new sample images, and the classification model needs to be retrained. Since the training cycle for this classification model is long, it leads to low efficiency in wheel rim recognition, and may even cause recognition to be interrupted due to model retraining. Summary of the Invention
[0005] The purpose of this application is to provide an object recognition method, apparatus, and electronic device that can avoid retraining the model when the type of the recognized object is a newly added type, thereby improving object recognition efficiency. The specific technical solution is as follows:
[0006] In a first aspect, embodiments of this application provide an object identification method, the method comprising:
[0007] Acquire an image of the object to be identified, and input the image into a preset feature extraction model to obtain the target image features of the object to be identified output by the feature extraction model;
[0008] Calculate the similarity between the target image features and the image features associated with each preset type in the preset association information; wherein, the image features associated with each preset type are extracted from the image of the object of that preset type using the feature extraction model;
[0009] Based on the calculated similarities, the type identification result of the object to be identified is determined.
[0010] Optionally, in one specific implementation, determining the type identification result of the object to be identified based on the calculated similarities includes:
[0011] The preset type associated with the image feature that has the highest similarity to the target image feature is determined as the target type of the object to be identified, and the type identification result of the object to be identified is obtained.
[0012] Optionally, in one specific implementation, determining the preset type associated with the image feature that has the highest similarity to the target image feature as the target type of the object to be identified includes:
[0013] If any of the calculated similarities is greater than the preset threshold, then the preset type associated with the image feature whose similarity to the target image feature is greater than the preset threshold and has the largest similarity is determined as the target type of the object to be identified.
[0014] The method further includes:
[0015] If none of the calculated similarities is greater than a preset threshold, a prompt message is output to indicate that the object to be identified does not belong to any of the multiple preset types.
[0016] Optionally, in one specific implementation, the method for establishing the preset association information includes:
[0017] Obtain images of objects of various types labeled with their respective preset types, and use them as registration images;
[0018] For each preset type, the image of the object belonging to that preset type in the registered image is input into the feature extraction model to obtain the association relationship between the image features of the preset type and the object of that preset type output by the feature extraction model, which is used as preset association information.
[0019] Optionally, in one specific implementation, the method further includes:
[0020] Retrieves a specified image labeled with a specified object of a specified type;
[0021] The specified image is input into the feature extraction model to obtain the new association between the specified type and the target image features of the specified object output by the feature extraction model;
[0022] The newly added relationship is added to the preset relationship information to obtain the updated preset relationship information.
[0023] Optionally, in one specific implementation, if none of the calculated similarities exceed a preset threshold, then before obtaining the specified image of the specified object labeled with the specified type, the method further includes:
[0024] Obtain the set type to which the object to be identified belongs, as determined by the user;
[0025] The process of obtaining a specified image labeled with a specified object of a specified type includes:
[0026] The image to be identified, labeled with the specified type, is determined as the designated image of the designated object labeled with the specified type.
[0027] Optionally, in one specific implementation, the method further includes:
[0028] When the number of new associations added in the preset association information exceeds the preset number, the feature extraction model is updated using multiple sample images of sample objects of various types included in the preset association information.
[0029] Optionally, in one specific implementation, the feature extraction model is trained using multiple sample images of sample objects of various preset types within the object type to which the object to be identified belongs.
[0030] Secondly, embodiments of this application provide an object recognition device, the device comprising:
[0031] The image acquisition module is used to acquire an image of the object to be identified and input the image to be identified into a preset feature extraction model to obtain the target image features of the object to be identified output by the feature extraction model.
[0032] The similarity calculation module is used to calculate the similarity between the target image features and the image features associated with each preset type in the preset association information; wherein, the image features associated with each preset type are extracted from the image of the object of the preset type using the feature extraction model;
[0033] The result determination module is used to determine the type identification result of the object to be identified based on the calculated similarities.
[0034] Optionally, in one specific implementation, the result determination module includes:
[0035] The result determination submodule is used to determine the preset type associated with the image feature with the highest similarity to the target image feature as the target type of the object to be identified, and obtain the type identification result of the object to be identified.
[0036] Optionally, in one specific implementation, the result-determining submodule is specifically used for:
[0037] If any of the calculated similarities is greater than the preset threshold, then the preset type associated with the image feature whose similarity to the target image feature is greater than the preset threshold and has the largest similarity is determined as the target type of the object to be identified.
[0038] The device further includes:
[0039] The output module is used to output a prompt message indicating that the object to be identified does not belong to any of the multiple preset types if none of the calculated similarities are greater than a preset threshold.
[0040] Optionally, in one specific implementation, the device further includes a preset association information establishment module, which is specifically used for:
[0041] Obtain images of objects of various types labeled with their respective preset types, and use them as registration images;
[0042] For each preset type, the image of the object belonging to that preset type in the registered image is input into the feature extraction model to obtain the association relationship between the image features of the preset type and the object of that preset type output by the feature extraction model, which is used as preset association information.
[0043] Optionally, in one specific implementation, the apparatus further includes:
[0044] The specified image acquisition module is used to acquire a specified image of a specified object that is labeled with its specified type;
[0045] An image input module is used to input the specified image into the feature extraction model to obtain a new association between the specified type and the target image features of the specified object output by the feature extraction model;
[0046] The information adding module is used to add the newly added relationship to the preset relationship information to obtain the updated preset relationship information.
[0047] Optionally, in one specific implementation, if none of the calculated similarities exceed a preset threshold, the device further includes:
[0048] The setting type acquisition module is used to acquire the setting type to which the object to be identified belongs, which is determined by the user, before acquiring the image of the specified object labeled with the specified type;
[0049] The specified image acquisition module is specifically used for:
[0050] The image to be identified, labeled with the specified type, is determined as the designated image of the designated object labeled with the specified type.
[0051] Optionally, in one specific implementation, the apparatus further includes:
[0052] The model update module is used to update the feature extraction model using multiple sample images of sample objects of each type included in the preset association information when the number of types included in the preset association information is greater than a preset number.
[0053] Optionally, in one specific implementation, the feature extraction model is trained using multiple sample images of sample objects of various preset types within the object type to which the object to be identified belongs.
[0054] Thirdly, embodiments of this application provide an electronic device, including:
[0055] Memory, used to store computer programs;
[0056] When a processor executes a program stored in memory, it implements the steps of any of the above method embodiments.
[0057] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of any of the above method embodiments.
[0058] Fifthly, embodiments of this application also provide a computer program product containing instructions that, when run on a computer, cause the computer to perform the steps of any of the above method embodiments.
[0059] Beneficial effects of the embodiments in this application:
[0060] As can be seen from the above, by applying the solution provided in the embodiments of this application, for the identified object type, a preset feature extraction model can be used to extract image features of objects belonging to each preset type of the object type, and preset association information between each preset type of the object type and the image features of objects belonging to each preset type can be established. Thus, when identifying an object belonging to the object type, the image of the object to be identified can be obtained, and the obtained image can be input into the aforementioned feature extraction model to obtain the target image features of the object to be identified output by the feature extraction model. Then, the similarity between the target image features and the image features associated with each preset type in the aforementioned preset association information can be calculated, and based on the calculated similarities, the type identification result of the object to be identified can be determined.
[0061] Based on this, the solution provided in this application embodiment is used to achieve object recognition by utilizing a preset feature extraction model and pre-established preset association information. By calculating the similarity between the target image features of the object to be identified and the image features of each known type of object, the target type of the object to be identified can be determined from the known types included in the preset association information. The feature extraction model is used for image feature extraction and does not directly identify the type of the object. The image features of each known type of object included in the preset association information are extracted by the feature extraction model. Therefore, when the type of the object to be identified is a new type, the image features of the new type of object can be extracted using the feature extraction model, and the association between the image features of the new type of object and the new type can be added to the preset association information. In this way, objects belonging to the new type can be identified in subsequent object recognition. Therefore, by applying the solution provided in the embodiments of this application, when the type of the identified object is a new type, there is no need to retrain the above feature extraction model. The image features of the new type of object can be extracted directly using the feature extraction model, and the above-mentioned preset association information can be updated. In this way, the situation of low object recognition efficiency caused by retraining the classification model due to the emergence of a new type can be avoided, thereby improving the object recognition efficiency. Attached Figure Description
[0062] To more clearly illustrate the technical solutions in the embodiments of this application 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 this application. For those skilled in the art, other embodiments can be obtained based on these drawings.
[0063] Figure 1 A flowchart illustrating an example of an object recognition method provided in an embodiment of this application;
[0064] Figure 2 A flowchart illustrating an object recognition method provided in an embodiment of this application;
[0065] Figures 3(a)-3(e) These are schematic diagrams illustrating specific examples of object recognition provided in the embodiments of this application;
[0066] Figure 4 A schematic diagram illustrating a specific example of acquiring an image to be identified, provided in an embodiment of this application;
[0067] Figure 5 A flowchart illustrating another object recognition method provided in an embodiment of this application;
[0068] Figure 6 A flowchart illustrating yet another object recognition method provided in an embodiment of this application;
[0069] Figure 7 A flowchart illustrating yet another object recognition method provided in an embodiment of this application;
[0070] Figure 8 A flowchart illustrating yet another object recognition method provided in an embodiment of this application;
[0071] Figure 9 A flowchart illustrating another example of the object recognition method provided in this application embodiment;
[0072] Figure 10 This is a schematic diagram of the structure of an object recognition device provided in an embodiment of this application;
[0073] Figure 11 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0074] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art based on this application are within the scope of protection of this application.
[0075] In related technologies, to identify wheel hubs of new models, multiple images of wheel hubs belonging to that new model are used as new sample images to retrain the classification model. Because the training cycle for the classification model is long, this results in low efficiency for wheel hub recognition, and may even cause recognition to be interrupted due to model retraining.
[0076] To address the aforementioned technical problems, this application provides an object recognition method.
[0077] This method is applicable to various application scenarios where object recognition is required, such as identifying the model of wheel hubs on a production line or identifying the type of tobacco.
[0078] This method can be applied to various electronic devices capable of data processing, such as mobile phones, tablets, and laptops. Furthermore, the electronic device can be equipped with an image acquisition device, so that the method can be executed after acquiring an image of the object to be identified; alternatively, the method can be executed after acquiring an image of the object to be identified from another device communicating with the electronic device.
[0079] Therefore, the embodiments of this application do not specifically limit the application scenarios and execution entities of the method.
[0080] An object recognition method provided in this application embodiment may include the following steps:
[0081] Acquire an image of the object to be identified, and input the image into a preset feature extraction model to obtain the target image features of the object to be identified output by the feature extraction model;
[0082] Calculate the similarity between the target image features and the image features associated with each preset type in the preset association information; wherein, the image features associated with each preset type are extracted from the image of the object of that preset type using the feature extraction model;
[0083] Based on the calculated similarities, the type identification result of the object to be identified is determined.
[0084] As can be seen from the above, by applying the solution provided in the embodiments of this application, for the identified object type, a preset feature extraction model can be used to extract image features of objects belonging to each preset type of the object type, and preset association information between each preset type of the object type and the image features of objects belonging to each preset type can be established. Thus, when identifying an object belonging to the object type, the image of the object to be identified can be obtained, and the obtained image can be input into the aforementioned feature extraction model to obtain the target image features of the object to be identified output by the feature extraction model. Then, the similarity between the target image features and the image features associated with each preset type in the aforementioned preset association information can be calculated, and based on the calculated similarities, the type identification result of the object to be identified can be determined.
[0085] Based on this, the solution provided in this application embodiment is used to achieve object recognition by utilizing a preset feature extraction model and pre-established preset association information. By calculating the similarity between the target image features of the object to be identified and the image features of each known type of object, the target type of the object to be identified can be determined from the known types included in the preset association information. The feature extraction model is used for image feature extraction and does not directly identify the type of the object. The image features of each known type of object included in the preset association information are extracted by the feature extraction model. Therefore, when the type of the object to be identified is a new type, the image features of the new type of object can be extracted using the feature extraction model, and the association between the image features of the new type of object and the new type can be added to the preset association information. In this way, objects belonging to the new type can be identified in subsequent object recognition. Therefore, by applying the solution provided in the embodiments of this application, when the type of the identified object is a new type, there is no need to retrain the above feature extraction model. The image features of the new type of object can be extracted directly using the feature extraction model, and the above-mentioned preset association information can be updated. In this way, the situation of low object recognition efficiency caused by retraining the classification model due to the emergence of a new type can be avoided, thereby improving the object recognition efficiency.
[0086] To facilitate understanding of the solutions provided in the embodiments of this application, the feature extraction model and the preset association information established based on the feature model in the object recognition method provided in the embodiments of this application will be briefly introduced below.
[0087] For some object types, the object type can be subdivided into multiple smaller types. Therefore, a known type in the object type can be used as the default type of the object type. For example, a wheel hub can include a variety of different models of wheel hubs, and a known model can be used as the default model of the wheel hub.
[0088] In some cases, it is necessary to identify each object belonging to a certain object type in order to determine the type of object within that object type. For example, identifying the model of a wheel hub on a production line.
[0089] For any object type, the image features of each object to be identified and the image features of each object of that object type can be used to identify the preset type to which each object belongs.
[0090] Based on this, for any object type, a preset feature extraction model can be used in advance to extract image features of images of objects belonging to that object type. Then, the image features extracted by the above feature extraction model are used to perform type recognition on the object to be identified.
[0091] The aforementioned preset feature extraction model can be a model that can be used to extract image features of various types of images, or it can be a model that can be used to extract image features of images belonging to the object type. Both are reasonable. In this embodiment, the aforementioned feature extraction model is not specifically limited.
[0092] Optionally, in one specific implementation, the feature extraction model is trained using multiple sample images of sample objects of various preset types within the object type to which the object to be identified belongs.
[0093] In this specific implementation, each object belonging to a preset type of the object type can be treated as a sample object, and each image of that sample object can be treated as a sample image. Therefore, multiple sample images of sample objects belonging to each preset type of the object type can be used to train a feature extraction model. The trained feature extraction model can then be used to extract image features from images of each object belonging to that object type.
[0094] For example, for wheel hubs, multiple preset wheel hub models can be determined in advance, and multiple wheel hub images belonging to each preset model can be obtained. Then, each wheel hub image can be used as a sample image, thus obtaining multiple sample images belonging to each sample model. Afterwards, the preset initial model can be trained using the multiple sample images belonging to each sample model, thereby obtaining a feature extraction model for extracting image features from wheel hub images.
[0095] After obtaining each sample image, a preset type can be labeled on the sample image to which the corresponding sample object belongs, thereby obtaining multiple sample images labeled with preset types.
[0096] Optionally, the sample category to which the object corresponding to the sample image belongs can be labeled on the sample image;
[0097] Optionally, multiple sample images of objects belonging to the same sample type can be stored in the same folder in advance, and all sample images in the folder can be batch-annotated. That is, the preset type corresponding to the folder can be batch-annotated on multiple sample images belonging to the folder, thereby realizing the rapid annotation of multiple sample images.
[0098] Next, the preset initial model can be trained using the multiple sample images labeled with preset types. When the preset initial model meets the preset conditions, the training is stopped, and the feature extraction model is obtained.
[0099] The aforementioned preset conditions can be set according to actual needs. For example, the number of iterations for each sample image can reach a first specified number, which can be set according to actual needs, such as 5 times, 10 times, etc.; the number of iterations for multiple sample images can reach a second specified number, which can be set according to actual needs, such as 500 times, 1000 times, etc.; the accuracy of the extracted image features can reach a preset accuracy, which can be set according to actual needs, such as 90%, 99%, etc.; or for each sample image, the error between the two image features obtained from two feature extractions of that sample image is not greater than a preset error threshold, which can be set according to actual needs, such as 3%, 0.5%, etc.
[0100] In this way, the feature extraction model trained using multiple sample images of sample objects of various preset types of the object type can effectively extract the image features of each object belonging to the object type.
[0101] The electronic device used for training the aforementioned model and the electronic device used for executing the object recognition method provided in this application embodiment may be the same electronic device or different electronic devices.
[0102] To obtain multiple sample images for training the feature extraction model, a type image library for the object type can be pre-built. For each preset type, the type image library can include at least one initial image of an object of that preset type. Thus, each object included in the type image library can be used as a sample object, and each image in the type image library can be used as a sample image.
[0103] To increase the number of sample images and improve the feature extraction accuracy of the trained feature extraction model, each initial image can be preprocessed.
[0104] The aforementioned preprocessing of the initial image may include performing at least one of the following operations on the initial image: cropping, affine transformation, mirroring, canvas enlargement, blurring, and HSV (Hue, Saturation, Value) space transformation.
[0105] Optionally, for the initial image mentioned above, cropping, affine transformation, mirroring, canvas enlargement, blurring, and HSV space transformation can be performed on the initial image to obtain multiple processed images;
[0106] Optionally, for the initial image described above, the above-mentioned cropping, affine transformation, mirroring, canvas enlargement, blurring, and HSV space transformation can be performed on the initial image to obtain a processed image.
[0107] Thus, for each of the above sample objects, both the initial image and the processed image of the sample object can be used as sample images of that sample object, thereby obtaining multiple sample images of that sample object.
[0108] Optionally, when using the above feature extraction model to extract image features for each sample image, a multi-pass feedforward mechanism can be adopted. First, each sample image is decomposed into multiple sample image blocks. Then, the sub-image features of each sample image block are extracted, and the extracted sub-image features are encoded as the global features of the sample image, thereby improving the feature extraction accuracy.
[0109] Optionally, when extracting image features for each sample image using the above feature extraction model, a feature embedding method can be used to embed the extracted image features into a high-dimensional space, thereby obtaining more compact global features for the sample image and thus achieving the purpose of enhancing image features.
[0110] Optionally, a ranking loss function can be used to perform supervised fine-tuning of the feature extraction model, thereby improving the feature extraction accuracy of the model.
[0111] In addition, in order to identify each object belonging to this object type, preset association information for this object type can be established in advance.
[0112] Optionally, the method of establishing the aforementioned preset association information may include the following steps 11-12:
[0113] Step 11: Obtain images of objects of each type labeled with their respective preset types, and use them as registration images;
[0114] Step 12: For each preset type, input the image of the object belonging to that preset type in the registered image into the feature extraction model, and obtain the association relationship between the image features of the preset type and the object of that preset type output by the feature extraction model, as the preset association information.
[0115] In this specific implementation, the images of each type of object labeled with its own preset type can be used as registration images. The process of establishing the association between the preset type and image features using each registration image is called the preset type registration process.
[0116] For each object type, in order to establish the association between each preset type and each image feature belonging to that object type, the registered images of each preset type can be obtained first.
[0117] Subsequently, for each preset type, images of objects belonging to that preset type from the aforementioned registered images can be input into the aforementioned feature extraction model. In this way, the feature extraction model can extract image features from each image of the object of that preset type, and associate the preset type with the extracted image features, thereby establishing a correlation between the preset type and the image features of the objects of that preset type, as preset association information.
[0118] In this way, for each preset type, the electronic device can obtain the correlation between the preset type and the image features of the object of the preset type output by the feature extraction model, and thus obtain the preset correlation information between each preset type and each image feature.
[0119] After establishing the preset association information using the aforementioned feature extraction model, the aforementioned feature extraction model and the aforementioned preset association information can be used to identify each object to be identified that belongs to the object type.
[0120] Furthermore, for each new type of this object type, the new type can be designated as the specified type. This allows for the acquisition of a specified image of a specified object labeled with the specified type, which is then input into the feature extraction model. The feature extraction model then extracts the target image features of the specified object, associates the specified type labeled on the specified image with the extracted target image features, establishes a new association between the specified type and the target image features of the specified object, and adds this new association to the preset association information, resulting in updated preset relationship information.
[0121] For example, such as Figure 1 As shown, an image database for object categories can be pre-established, which can include reference images of objects of various preset types belonging to that object category.
[0122] The aforementioned reference images are preprocessed in batches to obtain multiple processed images. Then, the aforementioned reference images and multiple processed images are used as sample images, and the batch feature extraction of the aforementioned sample images is performed using a preset feature extraction model to obtain the image features of each of the aforementioned sample images, as well as preset association information about each preset type and each image feature.
[0123] Subsequently, when recognizing the image of the object to be recognized, the image can first be preprocessed, and then the aforementioned feature extraction model can be used to extract features from the image to obtain the target image features of the object to be recognized. Next, the similarity between the target image features and each image feature in the aforementioned preset association information is calculated. Thus, the type recognition result of the object to be recognized is determined using the calculated multiple similarities, and the type recognition result is output.
[0124] Then, the results can be recalled, and the above-mentioned type identification results can be used to provide feedback and adjustments to the above-mentioned feature extraction model and the above-mentioned preset association information.
[0125] The following is a detailed description of an object recognition method provided by an embodiment of this application, with reference to the accompanying drawings.
[0126] Figure 2 This is a flowchart illustrating an object recognition method provided in an embodiment of this application, as shown below. Figure 2 As shown, the method may include the following steps S201-S203.
[0127] S201: Obtain the image of the object to be identified and input the image into the preset feature extraction model to obtain the target image features of the object to be identified output by the feature extraction model;
[0128] For some object types, the object type can include multiple types, and each type of the object type can be represented by a different model. Typically, it is necessary to identify each object belonging to that object type to determine the specific type within that object type.
[0129] For example, different types of wheel rims can be distinguished by different model numbers. In the wheel rim production workshop, each wheel rim needs to be identified to determine its model number, and further, to determine the type of wheel rim it belongs to.
[0130] Therefore, in order to identify different types of objects belonging to this object type, we can first determine the multiple types of the object category and the image features of objects belonging to each type.
[0131] Based on this, a known type of the object can be predetermined as a preset type. Then, a preset feature extraction model can be used to register each preset type. In other words, an image of an object labeled with each preset type can be input as the feature extraction model. This model can then extract image features from each image and associate these features with the preset type labeled on the image, thus obtaining the association between the preset type and the image features. For multiple preset types of the object, preset association information, including the association between each preset type and the image features, can be obtained.
[0132] In this way, when identifying any object belonging to this object type, the target image features of the object can be extracted using the above feature extraction model, and the target image features can be matched with the image features associated with each preset type in the above preset association information. Thus, the type of the object can be determined based on the matching results of the target image features and each image feature.
[0133] Based on this, when identifying an object belonging to this object category, the image of the object to be identified can be obtained first, and then the image can be input into the feature extraction model described above. In this way, the feature extraction model can extract features from the image to be identified and output the target image features of the object to be identified.
[0134] Then, the electronic device can acquire the target image features of the object to be identified output by the feature extraction model, and use the target image features to determine the type of the object to be identified.
[0135] For example, the object to be identified mentioned above includes a wheel hub. Wheel hubs can include various different types, each of which can be represented by a different model number. For example... Figures 3(a)-3(b) As shown, wheel hub 310 in Figure 3(a) and wheel hub 320 in Figure 3(b) belong to different models. To identify the models of wheel hubs 310 and 320, images of wheel hubs 310 and 320 can be obtained in advance. Figure 4As shown, a conveyor belt can be used to transport the wheel hub workpiece to a designated image acquisition area. A surface light source and an image acquisition device are positioned above this designated image acquisition area, with a 50mm cable allowance reserved above the image acquisition device. The distance between the lens of the image acquisition device and the conveyor belt is 800mm. When the wheel hubs 310 and 320 to be identified are transported to the designated image acquisition area by the conveyor belt, the image acquisition device can acquire images of the wheel hubs 310 and 320 to be identified, respectively. In this way, the electronic equipment can acquire each image to be identified and input the acquired images into a feature extraction model to obtain the image features of the wheel hubs 310 and 320 to be identified.
[0136] S202: Calculate the similarity between the target image features and the image features associated with each preset type in the preset association information;
[0137] The image features associated with each preset type are obtained by extracting the image of the object of that preset type using a feature extraction model;
[0138] After obtaining the target image features of the object to be identified, for each preset type of image feature associated with the above preset association information, the similarity between the target image feature and the image feature can be calculated, thereby obtaining the similarity between the target image feature and the image features associated with each preset type in the preset association information.
[0139] The similarity between the target image feature and each image feature represents the degree of matching between the target image feature and the image feature. The degree of matching between the target image feature of the object to be identified and the image feature represents the probability that the object to be identified belongs to a preset type associated with that image feature. The higher the similarity between the target image feature of the object to be identified and the image feature associated with a preset type, the greater the probability that the object to be identified belongs to that preset type.
[0140] Therefore, the type identification result of the object to be identified can be determined by using the calculated similarity scores.
[0141] Specifically, the similarity between the target image features and the image features associated with each preset type in the preset association information can be calculated using the target image features and the Euclidean distance, Manhattan distance, Mahalanobis distance, Hamming distance, Chebyshev distance, etc.
[0142] S203: Based on the calculated similarities, determine the type identification result of the object to be identified.
[0143] After calculating the similarity between the target image features and the image features associated with each preset type, since each similarity can reflect the degree of matching between the target image features and the image features associated with each preset type, the type recognition result of the image to be recognized can be determined by using the above similarities.
[0144] Alternatively, in one specific implementation, such as Figure 5 As shown, step S203 above may include the following step S2031:
[0145] S2031: The preset type associated with the image feature that has the highest similarity to the target image feature is determined as the target type of the object to be identified, and the type identification result of the object to be identified is obtained.
[0146] In this specific implementation, the greater the similarity between the target image feature of the object to be identified and an image feature, the more closely the target image feature matches the image feature, and thus, the greater the likelihood that the object to be identified belongs to the preset type associated with that image feature. Based on this, after calculating each similarity, the preset type associated with the image feature that has the highest similarity to the aforementioned target image feature can be determined as the target type of the object to be identified. In this way, the aforementioned target type can be used as the type identification result of the object to be identified.
[0147] For example, if the calculated similarity is 30%, 17%, 59%, 10%, 80%, and 94%, and the maximum value among all similarity is 94%, then the preset type associated with the image feature with the highest similarity to the target image feature can be determined as the target type of the object to be identified. That is, the type A associated with the image feature with a similarity of 94% to the target image feature can be determined as the type identification result of the object to be identified.
[0148] Optionally, since there may be multiple similarities that are relatively close, each of the determined similarities can be output, allowing staff to manually determine the target type of the object to be identified based on these similarities. The calculated similarities can be sorted in descending order. Then, a specified number of preset types associated with the image features corresponding to the first specified number of similarities are all determined as candidate types of the object to be identified. These specified number of candidate types and their corresponding similarities are then used as the type identification result for the object to be identified, and this type identification result is output so that relevant staff can determine the target type of the object based on it.
[0149] The specified quantity can be set according to actual needs, such as 3, 5, or the total number of preset types. These are all reasonable and are not specifically limited in this implementation. Furthermore, when the specified quantity is the total number of preset types, each preset type and its corresponding similarity can be determined as the type recognition result of the object to be identified.
[0150] For example, if the calculated similarities are 30%, 17%, 59%, 10%, 80%, and 94%, then these similarities can be sorted in ascending order, resulting in a sorted similarity order of 94%, 80%, 59%, 30%, 17%, and 10%. In this way, the preset types associated with the three image features with the highest similarity to the target image features, along with the corresponding similarities for each preset type, can be used as the type identification results for the object to be identified. Therefore, the type identification results for the object to be identified are: Type A (94%), Type B (80%), and Type C (59%). After outputting the type identification results, relevant personnel can determine the target type of the object to be identified as Type A based on these results.
[0151] However, in some cases, the aforementioned preset association information may not include the association relationship of the type to which the object to be identified belongs. For example, the type to which the object to be identified belongs may be a newly added type. In this case, the obtained similarity scores may all be relatively small, and thus, the maximum similarity score among the various similarity scores will also be relatively small. If the preset type associated with the image feature that has the maximum similarity score to the target image feature is determined as the target type of the object to be identified, the accuracy of the obtained type identification result will be poor.
[0152] For example, if the calculated similarity is 3%, 17%, 19%, 10%, and 44%, then the maximum similarity among all similarities is 44%. The image feature with a similarity of 44% to the target image feature still has a relatively low similarity to the target image feature. Therefore, the preset type associated with the image feature with the maximum similarity to the target image feature is determined as the target type of the object to be identified, resulting in poor accuracy of the type identification result.
[0153] Therefore, to improve the accuracy of object recognition, a preset threshold can be set in advance. For each image feature, when the similarity between the image feature and the target image feature is not greater than the preset threshold, the object to be identified is less likely to belong to the preset type associated with that image feature; while when the similarity between the image feature and the target image feature is greater than the preset threshold, the object to be identified is more likely to belong to the preset type associated with that image feature.
[0154] Based on this, in one optional implementation, such as Figure 6As shown, step S2031 above may include the following step S20311:
[0155] S20311: If among the calculated similarities, there is a similarity greater than a preset threshold, then the preset type associated with the image feature whose similarity to the target image feature is greater than the preset threshold and has the largest similarity is determined as the target type of the object to be identified.
[0156] Accordingly, the object recognition method provided in this application embodiment may further include the following step S20312:
[0157] S20312: If none of the calculated similarities is greater than a preset threshold, then output a prompt message indicating that the object to be identified does not belong to any of the multiple preset types.
[0158] In this specific implementation, after calculating each similarity, it can be determined whether there is a similarity greater than the preset threshold among each similarity.
[0159] The aforementioned preset threshold can be set according to actual needs, such as 70%, 0.9%, etc., which are all reasonable and are not specifically limited in this application embodiment.
[0160] If among the calculated similarities, there is a similarity greater than the preset threshold, then the preset type associated with the image feature whose similarity to the target image feature is greater than the preset threshold and has the largest similarity can be determined as the target type of the object to be identified, and this target type is determined as the target type of the object to be identified.
[0161] Conversely, if none of the calculated similarities exceed the aforementioned preset threshold, it can be determined that none of the preset types belong to the target type of the object to be identified. Therefore, the type identification result for the object to be identified is: the object to be identified does not belong to any of the multiple preset types. In this case, a prompt message indicating that the object to be identified does not belong to any of the multiple preset types can be output, allowing relevant personnel to confirm and verify the type identification result based on this information.
[0162] Optionally, if among the calculated similarities, there is a similarity greater than a preset threshold, then each preset type associated with each image feature whose similarity to the target image feature is greater than the preset threshold can be determined as a candidate type of the object to be identified, and each candidate type and the similarity corresponding to each candidate type can be determined as the type identification result of the object to be identified.
[0163] For example, for the wheel hub 320 to be identified shown in Figure 3(b), the similarity between the target image features of the wheel hub 320 and image features D of the preset model O, the similarity between the target image features of the wheel hub 320 and image features E of the preset model P, and the similarity between the target image features of the wheel hub 320 and image features F of the preset model Q are calculated. Specifically, as shown in Figure 3(c), the similarity between the target image features of the wheel hub 320 and image feature D is calculated to be 98%; as shown in Figure 3(d), the similarity between the target image features of the wheel hub 320 and image feature E is calculated to be 60%; and as shown in Figure 3(e), the similarity between the target image features of the wheel hub 320 and image feature F is calculated to be 51%. Thus, when the preset threshold is 50%, the preset type O associated with image feature D, the similarity corresponding to preset type O, the preset type P associated with image feature E, the similarity corresponding to preset type P, the preset type Q associated with image feature F, and the similarity corresponding to preset type Q can all be used as the type recognition result of the object to be identified. Therefore, the following can be output: Figures 3(c)-3(e) This serves as the type identification result for the object to be identified.
[0164] As technology advances and products are updated, the types included in any given object type can be continuously increased. Thus, for any given object type, each time a new type is added, a relationship can be established between the image features of that new type and the objects belonging to that new type.
[0165] Alternatively, in one specific implementation, such as Figure 7 As shown in the embodiments of this application, an object recognition method may further include the following steps S204-S206:
[0166] S204: Retrieve the specified image of the specified object that is labeled with the specified type;
[0167] S205: Input the specified image into the feature extraction model to obtain the new association between the specified type of output of the feature extraction model and the target image features of the specified object;
[0168] S206: Add the newly added relationship to the preset relationship information to obtain the updated preset relationship information.
[0169] In this specific implementation, each time a new type is added to the object type, the newly added type can be used as the specified type. Then, a specified image of a specified object associated with the specified type is obtained and input into the feature extraction model. In this way, the feature extraction model can extract the target image features of the specified object, associate the specified type associated with the specified image with the extracted target image features, establish a new association between the specified type and the target image features of the specified object, and output the new association.
[0170] In this way, the electronic device can obtain the newly added associations output by the feature extraction model and add them to the preset association information to obtain the updated preset association information.
[0171] Based on this, when a new type is added to this object type, the aforementioned method of establishing associations can be used to establish new associations between the new type and the image features of objects belonging to that new type. These new associations are then added to the aforementioned preset association information, which is continuously updated. In this way, by continuously updating the preset association information, the accuracy of identifying the types of objects within this object type using the aforementioned feature extraction model and the preset association information can be improved without retraining the feature extraction model or rebuilding the preset association information. This avoids interrupting object recognition due to retraining the feature extraction model or rebuilding the preset association information, thereby improving object recognition efficiency.
[0172] In addition, in such Figure 6 Based on one specific implementation shown, since there may be cases where the aforementioned preset association information does not include all the association relationships of the object type, in such cases, the result of identifying the object using the aforementioned preset association information may be that the object to be identified does not belong to any of the multiple preset types. Therefore, when the object to be identified does not belong to any of the multiple preset types, a manually determined set type to which the object to be identified belongs can be obtained. Then, using the aforementioned set type and the aforementioned image to be identified, a new association relationship between the image features of the set type and objects belonging to that set type can be established.
[0173] Optionally, in one specific implementation, if none of the calculated similarities exceed a preset threshold, then before step S204 above, the object recognition method provided in this application embodiment may further include the following step 21:
[0174] Step 21: Obtain the set type to which the object to be identified belongs, as determined by the user;
[0175] Accordingly, step S204 above may include step 22 as follows:
[0176] Step 22: Determine the image to be recognized that is labeled with a set type, and use it as the designated image of the designated object that is labeled with the specified type.
[0177] In this specific implementation, if none of the calculated similarities exceeds a preset threshold, a notification message stating that the image to be identified does not belong to any preset type can be output so that staff can receive the notification message. Upon receiving the notification message, staff can manually determine the preset type to which the image to be identified belongs and send the determined preset type to the electronic device.
[0178] In this way, the electronic device can obtain the set type to which the object to be identified belongs, which is determined by the user, and then mark the set type in the image to be identified, thereby obtaining an image to be identified marked with the set type.
[0179] Subsequently, the electronic device can use the aforementioned set type as the designated type, the object to be identified as the designated object, and the image to be identified that is identified with the aforementioned set type as the designated image of the designated object labeled with the designated type. Then, the designated image is input into the aforementioned feature extraction model to obtain the newly added association relationship between the designated type and the target image features of the designated object output by the aforementioned feature extraction model, and the newly added association relationship is added to the preset association information to obtain the updated preset association information.
[0180] In other words, for any object to be identified, if it is found that the object does not belong to any of the multiple preset types, a predefined type for the object can be obtained. Then, using this predefined type and the image of the object to be identified, an association relationship between the image features of the predefined type and the image is established, and this association relationship is added to the preset association information. Thus, the preset association information includes the preset type and image features of the object to be identified. Therefore, during subsequent object identification, this association relationship can be used to determine the type of a new object to be identified.
[0181] As can be seen from the above, the object recognition method provided in this application is achieved using a preset feature extraction model and pre-established preset association information. By calculating the similarity between the target image features of the object to be recognized and the image features of each known type of object, the target type of the object to be recognized can be determined from the known types included in the preset association information. The feature extraction model is used for image feature extraction and does not directly identify the type of the object. The image features of each known type of object included in the preset association information are extracted by the feature extraction model. Therefore, when the type of the object to be recognized is a new type, the image features of the new type of object can be extracted using the feature extraction model, and the association between the image features of the new type of object and the new type can be added to the preset association information. In this way, objects belonging to the new type can be recognized in subsequent object recognition processes. Therefore, by applying the solution provided in the embodiments of this application, when the type of the identified object is a new type, there is no need to retrain the above feature extraction model. The image features of the new type of object can be extracted directly using the feature extraction model, and the above-mentioned preset association information can be updated. In this way, the situation of low object recognition efficiency caused by retraining the classification model due to the emergence of a new type can be avoided, thereby improving the object recognition efficiency.
[0182] As the number of new object types continues to increase, the feature extraction model's performance in extracting features from images of objects belonging to these new types decreases, thus affecting the accuracy of type recognition results.
[0183] Therefore, in order for the feature extraction model to accurately extract the image features of each object belonging to the newly added type in the object type, the image of each type of object included in the preset association information can be used to update the above feature extraction model.
[0184] Alternatively, in one specific implementation, such as Figure 8 As shown in the embodiment of this application, an object recognition method may further include the following step S207:
[0185] S207: When the number of newly added relationships in the preset association information is greater than the preset number, the feature extraction model is updated using multiple sample images of sample objects of various types included in the preset association information.
[0186] In this specific implementation, as the number of new object types increases, the number of new associations in the preset association information also increases. Therefore, when the number of new associations in the preset association information exceeds a preset limit, objects of all types included in the preset association information can be used as sample objects, and the images of each sample object can be used as sample images. Furthermore, multiple sample images of the sample objects of all types included in the preset association information can be used to update the aforementioned preset feature extraction model.
[0187] The preset quantity can be set according to actual needs, such as 200, 400, etc., which are all reasonable and are not specifically limited in this application embodiment.
[0188] Optionally, when the number of types included in the preset association information is greater than the first specified number, the feature extraction model is updated using multiple sample images of sample objects of each type included in the preset association information; wherein, the first specified number can be set according to actual needs, such as 500, 1000, etc., which are all reasonable and are not specifically limited in this application embodiment.
[0189] Optionally, when a second specified number of new associations are detected in the preset association information, the feature extraction model is updated using multiple sample images of sample objects of various types included in the preset association information; wherein, the second specified number can be set according to actual needs, such as 50, 100, etc., which are all reasonable and are not specifically limited in this application embodiment.
[0190] To facilitate understanding of the object recognition method provided in the embodiments of this application, a wheel hub is used as an example. Figure 9 This application provides an example of an object recognition method.
[0191] The identification of wheel hubs may include the following steps S901-S906:
[0192] S901: Create a wheel hub image library and a sample image set;
[0193] S902: Training the wheel hub feature extraction model;
[0194] S903: Register each preset model to obtain the preset association information of each preset model;
[0195] S904: Use a camera to capture an image of the wheel hub to be identified;
[0196] S905: Outputs wheel hub model through the image model retrieval module;
[0197] S906: If the image to be identified is a wheel hub image that does not belong to the preset model, register the image to be identified.
[0198] For wheel hubs, multiple preset models of wheel hubs can be determined. Then, a wheel hub image library is created, which includes wheel hub images belonging to each preset model. Each wheel hub image in the wheel hub image library is labeled with the preset model to which the wheel hub in the image belongs. Then, each wheel hub image labeled with the preset model is used as a sample image, thereby creating a sample image set.
[0199] The initial model is trained using each sample image in the sample image set. When the initial model meets the preset conditions, the wheel hub feature extraction model is obtained and the wheel hub image extraction model is saved as a wheel hub feature extraction model.bin file.
[0200] Furthermore, since each sample image is labeled with a preset model number corresponding to that sample image, the aforementioned wheel hub feature extraction model can extract the image features of each sample image and use these image features as image features belonging to the preset model number labeled in that sample image. In this way, the aforementioned wheel hub feature extraction model can output the association relationship between the preset model number and the extracted image features, thereby obtaining the preset association information between each preset model number and each image feature, and storing the obtained preset association information as a preset association information.gall file as a database file.
[0201] The process of establishing the association between each preset model and the image features of the wheel hub belonging to that preset model can be referred to as the registration of the preset model.
[0202] The aforementioned feature extraction model (.bin file) and the aforementioned preset association information (.gall file) are loaded into the image model retrieval module. Thus, when identifying a wheel hub, an image of the wheel hub to be identified can first be captured using a camera. Then, the captured image is input into the image model retrieval module. This module can then input the image into the wheel hub feature extraction model to obtain the target image features of the wheel hub. Next, the similarity between the target image features and each image feature included in the preset association information can be calculated. Then, the preset model associated with the image feature corresponding to the highest similarity score (greater than a preset threshold) is taken as the wheel hub model of the wheel hub to be identified. Finally, the image model retrieval module can output the wheel hub model.
[0203] If the similarity between the target image features and each image feature included in the preset association information is less than a preset threshold, then the image to be identified is a wheel hub image that does not belong to the preset model. Therefore, the model acquisition request of the wheel hub to be identified can be output, and the target model of the wheel hub to be identified determined by the user can be received.
[0204] Afterwards, the image to be identified can be registered by inputting the image to be identified labeled with the target model into the above wheel hub feature extraction model, obtaining the new association between the target model output by the above wheel hub feature extraction model and the image features of the image to be identified, and adding the new association to the preset association information .gall file.
[0205] In this way, the preset association information, including the newly added association, can be used to identify the model of each wheel hub to be identified.
[0206] Based on the same inventive concept, and corresponding to the embodiments provided in this application Figure 2 The present application provides an object recognition device in addition to the object recognition method shown in the embodiment.
[0207] Figure 10 This is a schematic diagram of the structure of an object recognition device provided in an embodiment of this application, as shown below. Figure 10 As shown in the embodiments of this application, an object recognition device may include the following modules:
[0208] The image acquisition module 1010 is used to acquire an image of the object to be identified and input the image to be identified into a preset feature extraction model to obtain the target image features of the object to be identified output by the feature extraction model.
[0209] The similarity calculation module 1020 is used to calculate the similarity between the target image features and the image features associated with each preset type in the preset association information; wherein, the image features associated with each preset type are extracted from the image of the object of the preset type using the feature extraction model;
[0210] The result determination module 1030 is used to determine the type identification result of the object to be identified based on the calculated similarities.
[0211] As can be seen from the above, the object recognition method provided in this application is achieved using a preset feature extraction model and pre-established preset association information. By calculating the similarity between the target image features of the object to be recognized and the image features of each known type of object, the target type of the object to be recognized can be determined from the known types included in the preset association information. The feature extraction model is used for image feature extraction and does not directly identify the type of the object. The image features of each known type of object included in the preset association information are extracted by the feature extraction model. Therefore, when the type of the object to be recognized is a new type, the image features of the new type of object can be extracted using the feature extraction model, and the association between the image features of the new type of object and the new type can be added to the preset association information. In this way, objects belonging to the new type can be recognized in subsequent object recognition processes. Therefore, by applying the solution provided in the embodiments of this application, when the type of the identified object is a new type, there is no need to retrain the above feature extraction model. The image features of the new type of object can be extracted directly using the feature extraction model, and the above-mentioned preset association information can be updated. In this way, the situation of low object recognition efficiency caused by retraining the classification model due to the emergence of a new type can be avoided, thereby improving the object recognition efficiency.
[0212] Optionally, in one specific implementation, the result determination module 1030 includes:
[0213] The result determination submodule is used to determine the preset type associated with the image feature with the highest similarity to the target image feature as the target type of the object to be identified, and obtain the type identification result of the object to be identified.
[0214] Optionally, in one specific implementation, the result-determining submodule is specifically used for:
[0215] If any of the calculated similarities is greater than the preset threshold, then the preset type associated with the image feature whose similarity to the target image feature is greater than the preset threshold and has the largest similarity is determined as the target type of the object to be identified.
[0216] The device further includes:
[0217] The output module is used to output a prompt message indicating that the object to be identified does not belong to any of the multiple preset types if none of the calculated similarities are greater than a preset threshold.
[0218] Optionally, in one specific implementation, the device further includes a preset association information establishment module, which is specifically used for:
[0219] Obtain images of objects of various types labeled with their respective preset types, and use them as registration images;
[0220] For each preset type, the image of the object belonging to that preset type in the registered image is input into the feature extraction model to obtain the association relationship between the image features of the preset type and the object of that preset type output by the feature extraction model, which is used as preset association information.
[0221] Optionally, in one specific implementation, the apparatus further includes:
[0222] The specified image acquisition module is used to acquire a specified image of a specified object that is labeled with its specified type;
[0223] An image input module is used to input the specified image into the feature extraction model to obtain a new association between the specified type and the target image features of the specified object output by the feature extraction model;
[0224] The information adding module is used to add the newly added relationship to the preset relationship information to obtain the updated preset relationship information.
[0225] Optionally, in one specific implementation, if none of the calculated similarities exceed a preset threshold, the device further includes:
[0226] The setting type acquisition module is used to acquire the setting type to which the object to be identified belongs, which is determined by the user, before acquiring the image of the specified object labeled with the specified type;
[0227] The specified image acquisition module is specifically used for:
[0228] The image to be identified, labeled with the specified type, is determined as the designated image of the designated object labeled with the specified type.
[0229] Optionally, in one specific implementation, the apparatus further includes:
[0230] The model update module is used to update the feature extraction model using multiple sample images of sample objects of various types included in the preset association information when the number of new associations added in the preset association information exceeds a preset number.
[0231] Optionally, in one specific implementation, the feature extraction model is trained using multiple sample images of sample objects of various preset types within the object type to which the object to be identified belongs.
[0232] This application also provides an electronic device, such as... Figure 11As shown, it includes:
[0233] Memory 1101 is used to store computer programs;
[0234] When the processor 1102 executes the program stored in the memory 1101, it implements the steps of any of the object recognition methods provided in the embodiments of this application.
[0235] Furthermore, the aforementioned electronic device may also include a communication bus and / or a communication interface, with the processor 1102, the communication interface, and the memory 1101 communicating with each other via the communication bus.
[0236] 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.
[0237] The communication interface is used for communication between the aforementioned electronic devices and other devices.
[0238] 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.
[0239] 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.
[0240] In another embodiment provided in this application, 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 above-described object recognition methods.
[0241] In another embodiment provided in this application, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to execute any of the object recognition methods described above.
[0242] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially 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 this application 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 that a computer can access 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), etc.
[0243] 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.
[0244] 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.
[0245] The above description is merely a preferred embodiment of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application are included within the scope of protection of this application.
Claims
1. An object recognition method, characterized in that, The method includes: Acquire an image of the object to be identified, and input the image into a preset feature extraction model to obtain the target image features of the object to be identified output by the feature extraction model; Calculate the similarity between the target image features and the image features associated with each preset type in the preset association information; wherein, the image features associated with each preset type are extracted from the image of the object of the preset type using the feature extraction model, the preset type is a known type among object types, and the preset association information is the association relationship between the known type and the image features of the object of the known type; Based on the calculated similarities, the type identification result of the object to be identified is determined; The determination of the type identification result of the object to be identified based on the calculated similarities includes: If any of the calculated similarities is greater than a preset threshold, the preset types associated with each image feature whose similarity to the target image feature is greater than the preset threshold are determined as candidate types of the object to be identified, and each candidate type and the similarity corresponding to each candidate type are determined as the type identification result of the object to be identified. If none of the calculated similarities is greater than a preset threshold, then a prompt message is output to indicate that the object to be identified does not belong to any of the preset types. When the number of new associations added in the preset association information exceeds the preset number, the feature extraction model is updated using multiple sample images of sample objects of various types included in the preset association information.
2. The method according to claim 1, characterized in that, The step of determining the type identification result of the object to be identified based on the calculated similarities further includes: The preset type associated with the image feature that has the highest similarity to the target image feature is determined as the target type of the object to be identified, and the type identification result of the object to be identified is obtained.
3. The method according to claim 2, characterized in that, The step of determining the preset type associated with the image feature that has the highest similarity to the target image feature as the target type of the object to be identified includes: If any of the calculated similarities is greater than the preset threshold, then the preset type associated with the image feature whose similarity to the target image feature is greater than the preset threshold and has the largest similarity is determined as the target type of the object to be identified.
4. The method according to claim 1, characterized in that, The methods for establishing the preset association information include: Obtain images of objects of various types labeled with their respective preset types, and use them as registration images; For each preset type, the image of the object belonging to that preset type in the registered image is input into the feature extraction model to obtain the association relationship between the image features of the preset type and the object of that preset type output by the feature extraction model, which is used as preset association information.
5. The method according to claim 4, characterized in that, The method further includes: Retrieves a specified image labeled with a specified object of a specified type; The specified image is input into the feature extraction model to obtain the new association between the specified type and the target image features of the specified object output by the feature extraction model; The newly added relationship is added to the preset relationship information to obtain the updated preset relationship information.
6. The method according to claim 5, characterized in that, If none of the calculated similarities exceed a preset threshold, then before obtaining the specified image of the specified object labeled with the specified type, the method further includes: Obtain the set type to which the object to be identified belongs, as determined by the user; The process of obtaining a specified image labeled with a specified object of a specified type includes: The image to be identified, labeled with the specified type, is determined as the designated image of the designated object labeled with the specified type.
7. The method according to any one of claims 1-6, characterized in that, The feature extraction model is trained using multiple sample images of sample objects of various preset types within the object type to which the object to be identified belongs.
8. An object recognition device, characterized in that, The device includes: The image acquisition module is used to acquire an image of the object to be identified and input the image to be identified into a preset feature extraction model to obtain the target image features of the object to be identified output by the feature extraction model. The similarity calculation module is used to calculate the similarity between the target image features and the image features associated with each preset type in the preset association information; wherein, the image features associated with each preset type are extracted from the image of the object of the preset type using the feature extraction model, the preset type is a known type among the object types, and the preset association information is the association relationship between the known type and the image features of the object of the known type; The result determination module is used to determine, if among the calculated similarities there is a similarity greater than a preset threshold, the preset types associated with the image features whose similarity to the target image features is greater than the preset threshold are determined as candidate types of the object to be identified, and each candidate type and the similarity corresponding to each candidate type are determined as the type identification result of the object to be identified. The output module is used to output a prompt message indicating that the object to be identified does not belong to any of the preset types if none of the calculated similarities are greater than a preset threshold. The model update module is used to update the feature extraction model using multiple sample images of sample objects of each type included in the preset association information when the number of types included in the preset association information is greater than a preset number.
9. The apparatus according to claim 8, characterized in that, The result determination module includes: The result determination submodule is used to determine the preset type associated with the image feature with the highest similarity to the target image feature as the target type of the object to be identified, and obtain the type identification result of the object to be identified; And / or, The result determination submodule is specifically used for: If any of the calculated similarities is greater than the preset threshold, then the preset type associated with the image feature whose similarity to the target image feature is greater than the preset threshold and has the largest similarity is determined as the target type of the object to be identified. And / or, The device further includes a preset association information establishment module, which is specifically used for: Obtain images of objects of various types labeled with their respective preset types, and use them as registration images; For each preset type, the image of the object belonging to that preset type in the registered image is input into the feature extraction model to obtain the association relationship between the image features of the preset type and the object of that preset type output by the feature extraction model, which is used as preset association information; And / or, The device further includes: The specified image acquisition module is used to acquire a specified image of a specified object that is labeled with its specified type; An image input module is used to input the specified image into the feature extraction model to obtain a new association between the specified type and the target image features of the specified object output by the feature extraction model; The information adding module is used to add the newly added association to the preset association information to obtain the updated preset association information; And / or, If none of the calculated similarities exceed a preset threshold, the device further includes: The setting type acquisition module is used to acquire the setting type to which the object to be identified belongs, which is determined by the user, before acquiring the image of the specified object labeled with the specified type; The specified image acquisition module is specifically used for: The image to be identified, labeled with the specified type, is determined as the specified image of the specified object labeled with the specified type. And / or, The device further includes: And / or, The feature extraction model is trained using multiple sample images of sample objects of various preset types within the object type to which the object to be identified belongs.
10. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor, when executing a program stored in memory, implements the method described in any one of claims 1-7.
11. 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 method described in any one of claims 1-7.
Citation Information
Patent Citations
Image recognition method, device and equipment, intelligent door lock and medium
CN114241557A