A prompt word optimization method for detecting image content using a large language model

By using the BOSE framework in a large language model to construct and match the task information required for image detection, more accurate prompt words are generated, which solves the problem of low image detection accuracy in the prior art and improves detection accuracy and efficiency.

CN119181096BActive Publication Date: 2025-03-25BEIJING ZHONGKE WUJI DATA TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411195979.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-29
Publication Date
2025-03-25
Estimated Expiration
2044-08-29

AI Technical Summary

Technical Problem

When generating image descriptions in the existing large language models, due to the deviation of training data and the universality of the model, the generated prompt words do not match the actual image content enough, which reduces the image detection accuracy.

Method used

By obtaining the user's image detection needs, using the BOSE framework to construct task information and match rules, perform language re-editing and semantic comparison, generate more accurate and comprehensive prompt words, and input them into a large language model for detection.

Benefits of technology

It improves the accuracy of image detection of large language models, reduces the number of detection rules, reduces the system's computing power requirements, and ensures the accuracy and singularity of output rules.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119181096B_ABST
    Figure CN119181096B_ABST
Patent Text Reader

Abstract

The present application discloses a prompt word optimization method for detecting image content using a large language model, and relates to the technical field of prompt word optimization. The method includes obtaining the user's image detection requirements and detection target image data, and inputting them into the BOSE framework for task information construction to obtain the description information of the image detection rule; matching the image detection requirements with the detection rules to obtain the hit requirement rule information; encoding the image detection requirements and the expression data according to the requirement rule information to obtain the requirement encoding data; grouping the requirement rule information, and combining the grouped requirement rule information and the description information of the image detection rules to obtain the prompt word data; the large language model detects the detection target image data according to the prompt word data to obtain the return result; parsing the return result of the large model to obtain the final processing result. The present application has the effect of improving the accuracy of the large language model in image detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of prompt word optimization, and in particular to a prompt word optimization method for detecting image content using a large language model. Background Art

[0002] With the rapid development of digital media, image content is becoming more and more widely used in various fields, including social media, advertising, surveillance, and education. Effectively detecting and understanding image content is crucial to improving user experience, enhancing information security, and promoting technological innovation.

[0003] Large language models are widely used in generating text descriptions of image content due to their powerful semantic understanding capabilities. However, when generating image descriptions, existing large language models fail to match the generated prompt words with the actual image content or lack sensitivity in specific fields due to bias in training data and limitations on the generality of the model. This results in reduced image detection accuracy based on large language models and there is room for improvement. Summary of the invention

[0004] In order to improve the accuracy of large language models in image detection, the present application provides a prompt word optimization method for detecting image content using a large language model.

[0005] In a first aspect, the present application provides a method for optimizing prompt words for detecting image content using a large language model, using the following technical solution:

[0006] A prompt word optimization method for detecting image content using a large language model, comprising:

[0007] Obtain the user's image detection requirements and detection target image data, and input the image detection requirements into the BOSE framework to construct task information and obtain the description information of the image detection rules;

[0008] Match the image detection requirements with the built-in detection rules to obtain the requirement rule information that matches the image detection requirements;

[0009] Based on the large language model, the image detection requirements are re-edited to obtain the expression data;

[0010] Performing demand judgment on the expression data to obtain the expression demand, and semantically comparing the expression demand with the image detection demand to determine the attribute information of the demand coding data corresponding to the expression demand and the image detection demand;

[0011] If the semantics of the expression requirement and the image detection requirement are the same, the expression requirement and the image detection requirement are forward encoded;

[0012] If the expression requirement is opposite to the image detection requirement in semantics, the expression requirement is reversely encoded under the same requirement rule information according to the forward encoding data of the image detection requirement to obtain reverse encoding data; wherein the requirement encoding data includes forward encoding and reverse encoding;

[0013] The demand rule information is grouped based on the attention value of the built-in large language model, and each group of demand rule information is combined with the description information of the image detection rule according to the built-in output rule to obtain the prompt word data;

[0014] Input the prompt word data and the detection target image data into the large language model, and detect the detection target image data according to the prompt word data to obtain the corresponding return result;

[0015] The return result of the large language model is parsed to obtain the final processing result, and the final processing result is output.

[0016] Preferably, the text language is judged for the image detection requirement input by the user. If the first prompt word data input by the user is English text, the image detection requirement is input into the BOSE framework to construct the prompt word;

[0017] If the image detection requirement input by the user is a Chinese text, a prompt word is preliminarily written for the image detection requirement, recorded as the first prompt word data, and the first prompt word data is input into the large language model for testing to obtain a test result;

[0018] If the test result meets the user's needs, the first prompt word data is translated into English prompt word data and recorded as the second prompt word data;

[0019] The second prompt word data is input into the BOSE framework for prompt word construction.

[0020] Preferably, the image detection requirements are input into a natural language processing model to determine the task category, and the corresponding role setting information is matched according to the task category;

[0021] Determine the task instructions for the large language model to detect the target image data according to the role setting information and the image detection requirements;

[0022] The role setting information and task instructions are combined and output according to the built-in prompt word output standard to obtain the description information of the image detection rules used to guide the thinking of the large language model.

[0023] Preferably, the BOSE framework includes background information B, output format O, standard S and example E;

[0024] The background information B is used to judge the image detection requirements to determine the role setting of the large language model when performing image processing;

[0025] The output format O is used to standardize the output content format of the large language model;

[0026] The standard S is used to judge the image detection requirements, determine the user's task objectives, and generate corresponding task instructions;

[0027] Example E is used to generate sample return results according to role settings, task instructions and the output content format of the built-in large language model.

[0028] Preferably, the requirement rule information is sorted in random order;

[0029] The randomly ordered demand rule information is grouped based on the built-in attention value to obtain grouped data;

[0030] Numbering the demand rule information in each grouped data to obtain a rule sequence number;

[0031] Combine the rule sequence number with the expression data of the corresponding requirement rule information to obtain the rule prompt word of each group data;

[0032] Based on the built-in prompt word combination specification, the description information of the image detection rule is combined with the rule prompt words of each grouping data to obtain the corresponding prompt word data.

[0033] Preferably, the requirement coding data, the expression data and the requirement rule information of the image detection requirement are counted one by one to obtain a rule comparison table;

[0034] The large language model receives the prompt word data and performs image description on the input detection target image data according to the description information of the image detection rule in the prompt word data to obtain corresponding image description information;

[0035] Semantically match the image description information with the expression data of the rule prompt word in the prompt word data to screen out the detection target image data with the same semantics as the image description information and the expression data, and match the successfully matched expression data with the rule comparison table to determine the corresponding rule number, which is recorded as the hit rule number;

[0036] Based on the output format O in the BOSE framework, the image description information and the hit rule sequence number of the successfully matched detection target image data are combined and output to obtain the return result of the corresponding detection target image data.

[0037] Preferably, a one-to-one correspondence is performed based on the requirement coding data in the requirement rule information and the rule serial number corresponding to the requirement rule information in the rule prompt word to obtain a serial number comparison table;

[0038] Get the returned result of the detected target image data, and split the returned result according to the output format O in the BOSE framework to obtain the image description information and the hit rule sequence number;

[0039] Determine the required coding data corresponding to the returned result according to the image description information and the hit rule sequence number;

[0040] Count the demand coding data in each group data to obtain an initial demand coding data table;

[0041] The attribute information of each demand coding data in the initial demand coding data table is judged. If the same detection rule in the initial demand coding data table contains both forward coding data and reverse coding data, the forward coding data of the detection rule is retained and the reverse coding data is removed to obtain an intermediate demand coding data table;

[0042] The detection rules having only reverse-coded data in the intermediate demand coding data table are filtered to obtain a final demand coding data table that does not contain demand coding data having only reverse coding and output it.

[0043] Preferably, the image description information is compared with the rule comparison table to determine whether the image description information matches the description data, and based on the successfully matched description data, the rule data hit by the image description information is determined and recorded as the first rule data;

[0044] Compare the hit rule serial number corresponding to the successfully matched image description information with the serial number comparison table to obtain the requirement coding data corresponding to each hit rule serial number, and match the rule comparison table according to the corresponding requirement coding to obtain the second rule data;

[0045] Comparing the first rule data with the second rule data under the same image description information to determine whether the first rule data is the same as the second rule data;

[0046] If the first rule data is the same as the second rule data, the requirement code data corresponding to the hit rule serial number is used as the requirement code data of the returned result;

[0047] If the first rule data is different from the second rule data, the returned result is removed.

[0048] In summary, the present application includes at least one of the following beneficial technical effects:

[0049] 1. By obtaining the user's image detection requirements and performing task analysis on the image detection requirements according to the set BOSE framework, the description information of the corresponding image detection rules is determined. By matching the image detection requirements with the built-in detection rules, the detection rules involved in the user's requirements are determined, which reduces the number of detection rules of the large language model, improves the detection efficiency and reduces the demand for system computing power. By re-editing the image detection requirements, the prompt effect of the prompt words composed of the requirement rule information and the description information of the image detection rules is made more accurate and comprehensive, thereby improving the accuracy of the detection results of the large language model. By re-analyzing the returned results of each group, the generation of multiple duplicate results is reduced, ensuring the accuracy and uniqueness of the final output rules.

[0050] 2. With the help of the built-in BOSE framework, the role positioning and processing purpose are regulated in a specific way, so that the large language model can understand the user's needs more accurately, and then the results obtained by the large language model based on user needs are more accurate, thereby improving the accuracy of the large language model in image processing;

[0051] 3. By re-editing the language of image detection requirements and making a semantic comparison between the expression data and the image detection requirements, the attribute relationship between the corresponding expression data and the image detection requirements is determined, and different encodings are performed under the same rule according to the attribute relationship. The large language model can determine the corresponding encoding according to the expression data and image detection requirements, and then quickly match the specified rules, thereby improving the accuracy and comprehensiveness of the detection results. At the same time, by encoding user requirements, the amount of data received by the large language model is reduced, thereby improving the data processing efficiency of the large language model. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] Figure 1 This is a flowchart of the steps of the method for optimizing prompt words for detecting image content using a large language model in this embodiment. DETAILED DESCRIPTION

[0053] The following is combined with Figure 1 This application is described in further detail.

[0054] The embodiment of the present application discloses a prompt word optimization method for detecting image content using a large language model.

[0055] Example: Figure 1 As shown, the present invention provides a prompt word optimization method for detecting image content using a large language model, comprising:

[0056] S100, obtain the user's image detection requirements and detection target image data, and input the image detection requirements into the BOSE framework for task information construction to obtain the description information of the image detection rules; wherein, the BOSE framework includes background information B (Background), output format O (Output Format), standard S (Specification) and example E (Example); background information B is used to judge the image detection requirements to determine the role setting of the large language model when performing image processing; output format O is used to standardize the output content format of the large language model; standard S is used to judge the image detection requirements, determine the user's task goals, and generate corresponding task instructions; example E is used to generate sample return results according to the role setting, task instructions and the output content format of the built-in large language model. Among them, the BOSE framework is not only suitable for the prompt word writing of image detection tasks, but also widely applicable to the prompt word framework of any task.

[0057] S200, matching the image detection requirement with the built-in detection rules to obtain requirement rule information matching the image detection requirement; wherein the built-in detection rules are detection rules that are manually compiled based on the user's image detection requirements and match the detection requirements.

[0058] S300, based on the large language model, the image detection requirements are re-edited to obtain expression data; the language re-editing is to generate different declarative sentence languages ​​according to the image detection requirements, to ensure that the expression of the same requirement is more comprehensive, thereby making the prompt words more accurate.

[0059] S400, performing demand judgment on the expression data to obtain the expression demand, and performing semantic comparison between the expression demand and the image detection demand to determine the attribute information of the demand coding data corresponding to the expression demand and the image detection demand;

[0060] S500, if the expression requirement and the image detection requirement have the same semantics, forward encoding the expression requirement and the image detection requirement;

[0061] S600, if the expression requirement and the image detection requirement have opposite semantics, reversely encode the expression requirement under the same requirement rule information according to the forward encoding data of the image detection requirement to obtain reverse encoding data; wherein the requirement encoding data includes forward encoding and reverse encoding;

[0062] S700, grouping the demand rule information based on the attention value of the built-in large language model, and combining the demand rule information and the description information of the image detection rule according to the built-in output rule for each group of demand rule information to obtain prompt word data;

[0063] S800, input the prompt word data and the detection target image data into the large language model, and detect the detection target image data according to the prompt word data to obtain the corresponding return result; wherein, the large language model is used to perform rule detection on the detection target image data, so as to determine the detection rule that the detection target image data hits.

[0064] S900: Parse the returned result of the large language model to obtain a final processing result, and output the final processing result.

[0065] In this embodiment, the image detection requirements of the user are obtained and task analysis is performed on the image detection requirements according to the BOSE framework to obtain the description information of the corresponding image detection rules. The image detection requirements are matched with the built-in detection rules to determine the detection rules involved in the user requirements, thereby reducing the number of detections of the detection rules by the large language model, improving the detection efficiency and reducing the demand for system computing power. The image detection requirements are re-edited in language to make the prompt effect of the prompt words composed of the requirement rule information and the description information of the image detection rules more accurate and comprehensive, thereby improving the accuracy of the detection results of the large language model. Since the detection rules are analyzed in a chaotic grouping manner, the return results of each group are re-parsed to reduce the generation of multiple duplicate results, thereby ensuring the accuracy of the final output rules.

[0066] Exemplarily, the user's demand is to automatically identify whether there is an image of "fisherman" in the input image through the large language model. The input image is image A. The background information, output format, judgment criteria and corresponding output sample return results of the large language model are determined by the BOSE model, thereby forming the task description part of the prompt word input to the large language model. Then, the user's demand is matched with the built-in detection rules, for example: "fisherman" is matched with the detection rules to obtain hit rules, such as: "person" rule, "fishing rod" rule, "pond" rule, "water" rule, "fish" rule, and the image detection demand is matched with the language Re-edit, for example, "fisherman", "fishing friend", etc., by matching the hit rules of "fisherman" and "fishing friend", so as to obtain multiple expressions of the same rule, and then group the demand coding data of the demand hit according to the attention value of the large language model. For example, the attention value is 2, and the rule combination obtained may be combination 1: "person" rule, "fishing rod" rule, "pond" rule, combination 2: "water" rule, "fish" rule, and then obtain the rule description part of the prompt word of the input value large language model, and input the task description part and the rule description part as a whole into the large language model to improve the concentration of the large language model. The large language model parses the input image data through the task description part to determine the element content and position relationship of the image data, and then matches the element content and position relationship with the rules in the rule description part to determine the hit rule in the image data, and output the rule accordingly, and then sort out the output rules accordingly to obtain the final hit rule, so that the large language model can perform corresponding processing according to the user's needs and the hit rule of the image data, ensuring the accuracy of the processing results.

[0067] By encoding the image detection requirements for the first time, the large language model can quickly read the rules according to the encoding, thereby reducing the amount of data received by the large language model and improving the processing efficiency of the data processing of the large language model. At the same time, by re-editing the image detection requirements, other expression sentences under the same image detection requirements can be determined, so that the large language model can more comprehensively and effectively determine the image hit rules when processing the image according to the requirements. At the same time, by comparing the expression data and the image detection requirements, the attribute relationship between each expression sentence and the requirement rule information can be determined, and then corresponding encoding can be performed according to the attribute relationship, so that the large language model can hit the rules when hitting the rules according to the expression sentences, so that the results of the large language model when determining the rule hits of the image are more accurate.

[0068] By re-editing the language of image detection requirements and making a semantic comparison between the expression data and the image detection requirements, the attribute relationship between the corresponding expression data and the image detection requirements is determined, and different encodings are performed under the same rule according to the attribute relationship. The large language model can determine the corresponding encoding according to the expression data and image detection requirements, and then quickly match the specified rules, thereby improving the accuracy and comprehensiveness of the detection results. At the same time, by encoding user requirements, the amount of data received by the large language model is reduced, thereby improving the data processing efficiency of the large language model.

[0069] For example, the image detection requirements include: requirement A, requirement B, and requirement C, and the corresponding requirement rules are rule 1, rule 2, and rule 3, respectively. Requirement A is encoded to obtain code a, and the corresponding codes of requirements B and C are recorded as codes b and c. By re-editing the language of requirements A, requirements B, and requirements C, the expression data of requirement A is obtained as S1, the expression statements of requirement B are S2 and S3, and requirement C has no expression statement. Then the corresponding relationship between them is (rule, requirement): (Rule 1, A, S1), (Rule 2, B, S2, S3), (Rule 3, C), where if S1 has the same semantics as A, S2 has the same semantics as B, and S3 has the opposite semantics as B, then the encoding of S1 is recorded as a, the encoding of S2 is recorded as b, and the encoding of S3 is recorded as ~b, so the rule comparison table obtained is (rule, encoding, requirement): (Rule 1, a, A, S1), (Rule 2, b, B, S2), (Rule 2, ~b, S3), (Rule 3, c, C).

[0070] For example, to filter images that contain only one person, the requirement may be: the number of people in the image is 1, or there are people in the image. The statement written based on the requirement may be: the number of people in the image is greater than 1. The statement: the number of people in the image is greater than 1 and the number of people in the image is 1 are two statements with opposite semantics under the same rule. Therefore, "the number of people in the image is 1" is marked as a, and "the number of people in the image is greater than 1" is marked as ~a.

[0071] Before step S100, the image detection requirements and detection target image data of the user are obtained, and the image detection requirements are input into the BOSE framework for task information construction. Before the step of obtaining the description information of the image detection rules, the following steps are also included:

[0072] S001, performing text language judgment on the image detection requirement input by the user. If the first prompt word data input by the user is English text, the image detection requirement is input into the BOSE framework to construct the prompt word;

[0073] S002, if the image detection requirement input by the user is a Chinese text, a prompt word is preliminarily compiled for the image detection requirement, recorded as first prompt word data, and the first prompt word data is input into the large language model for testing to obtain a test result;

[0074] S003, if the test result meets the user's needs, the first prompt word data is translated into English prompt word data and recorded as second prompt word data;

[0075] S004, inputting the second prompt word data into the BOSE framework to construct the prompt word.

[0076] In this embodiment, since the current large language model is mainly trained and fine-tuned with English as the data set, a more accurate effect can be achieved by setting the prompt words of the large language model to English. Therefore, before analyzing the user's needs, a text language judgment is made on the user's image detection needs to determine whether it is necessary to perform text language conversion on the analysis results of the user's image detection needs. When the image detection needs are in English, it indicates that no text language conversion is required. Therefore, prompt words are directly constructed for the image detection needs. If the image detection needs are in Chinese, Chinese prompt words are constructed for the Chinese image detection needs to determine the large language model's understanding of the Chinese prompt words, thereby determining the accuracy of the prompt words constructed in Chinese. If it is determined to be accurate, the Chinese prompt words are converted into English prompt words, further ensuring the accuracy of the large language model.

[0077] In step S100, the user's image detection requirements and detection target image data are obtained, and the image detection requirements are input into the BOSE framework for task information construction to obtain the description information of the image detection rules, including the following steps:

[0078] S110, input the image detection requirements into the natural language processing model to determine the task category, and match the corresponding role setting information according to the task category; wherein the natural language processing model is designed to enable computers to understand and generate human natural language, thereby achieving seamless communication between humans and machines, and then determine the role information of the large language model in the user's image detection needs through the natural language processing model.

[0079] S120, determining a task instruction when the large language model detects the detection target image data according to the role setting information and the image detection requirement;

[0080] S130, combining and outputting the role setting information and the task instruction according to the built-in prompt word output standard, and obtaining description information of the image detection rule for guiding the thinking of the large language model.

[0081] In this embodiment, the user's image detection needs are analyzed through the built-in BOSE framework to determine the role positioning and processing purpose of the large language model in processing the user's needs. The role positioning and processing purpose are organized in a specific way through the BOSE framework so that the large language model can understand the user's needs more accurately, thereby making the results obtained by the large language model based on the user's needs more accurate, thereby improving the accuracy of the large language model.

[0082] Exemplarily, for example, the image detection requirements are analyzed through the BOSE framework, the role setting information obtained is information A, and the task instruction is instruction B, then the output description information is (A, B).

[0083] In step S700, the requirement rule information is grouped based on the attention value of the built-in large language model, and each group of the requirement rule information is combined with the description information of the image detection rule according to the built-in output rule to obtain the prompt word data, including the following steps:

[0084] S710, sorting the demand rule information in random order;

[0085] S720, grouping the randomly ordered demand rule information based on the built-in attention value to obtain grouped data;

[0086] S730, numbering the demand rule information in each group of data to obtain a rule sequence number;

[0087] S740, combining the rule sequence number with the expression data of the corresponding requirement rule information to obtain the rule prompt word of each group data;

[0088] S750, based on the built-in prompt word combination specification, combine the description information of the image detection rule with the rule prompt words of each grouping data to obtain corresponding prompt word data.

[0089] In this embodiment, by sorting the demand rule information in random order, the large language model does not rely on a fixed rule order during the learning process, reducing excessive dependence on specific data distribution or processing flow, thereby making the processing result of the large language model on new image data better, and by grouping the randomly sorted demand rules according to the attention value of the large language model, it not only reduces the amount of data when the large language model performs a data analysis, thereby improving the detection efficiency, but also ensures the concentration of the large language model by grouping according to the attention value. At the same time, according to the built-in prompt word combination specification, it ensures the effective understanding of the prompt word by the large language model, thereby further improving the detection efficiency.

[0090] For example, the requirement rule information includes rule 1, rule 2, rule 3, and rule 4. By randomly sorting, rule 2, rule 4, rule 1, and rule 3 are obtained. For example, if the attention value is 2, the grouped data after grouping is group 1: rule 2 and rule 4; group 2: rule 1 and rule 3. The requirement rule information in the grouped data after grouping is encoded, for example, the encoding result of group 1 is (1; 2), and the encoding result of group 2 is (1; 2). Then, the rule extraction result is obtained by combining the expression data with the rule sequence number. For example, the statement corresponding to rule 1 is S1, the statement corresponding to rule 2 is S2, and so on. The combination results are group 1: (1, S2; 2, S4), group 2: (1, S1; 2, S3); then according to the prompt word combination specification, the description information of the image detection rule is combined with the rule prompt word, and the prompt word data obtained is: (description information, rule prompt word). For example, if the description information is A, the prompt words are (A, 1, S2; 2, S4) and (A, 1, S1; 2, S3).

[0091] In step S800, the prompt word data and the detection target image data are input into the large language model, and the detection target image data is detected according to the prompt word data to obtain the corresponding return result, including the following steps:

[0092] S810, performing one-to-one correspondence statistics on the requirement coding data, the expression data and the requirement rule information of the image detection requirement to obtain a rule comparison table;

[0093] S820, the large language model receives the prompt word data and performs image description on the input detection target image data according to the description information of the image detection rule in the prompt word data to obtain corresponding image description information;

[0094] S830, semantically matching the image description information with the expression data of the rule prompt word in the prompt word data, so as to screen out the detection target image data with the same semantics as the image description information and the expression data, and matching the successfully matched expression data with the rule comparison table, determining the corresponding rule number, and recording it as the hit rule number;

[0095] S840, based on the output format O in the BOSE framework, the image description information of the successfully matched detection target image data and the hit rule sequence number are combined and output to obtain the return result of the corresponding detection target image data.

[0096] In this embodiment, the large language model determines the task information through the description information of the image detection rules in the prompt word data, and performs an image description on the detection target image data according to the task information, and then semantically matches the image description information with the expression data in the rule prompt words in the prompt words, so as to effectively determine the rule number hit by the detection target image data, and then output the corresponding image description information and the hit rule number according to the set output format.

[0097] The role of the large language model is set through the description information of the image detection rules, which effectively guides the large language model to detect the target image data, making the image description information more accurate and effective, and further making it more accurate to determine the hit rule number based on the image description information, thereby improving the accuracy of the large language model detection results.

[0098] In step S900, the returned result of the large language model is parsed to obtain a final processing result, and the final processing result is output, including the following steps:

[0099] S910, performing one-to-one correspondence statistics based on the requirement code data in the requirement rule information and the rule serial numbers corresponding to the requirement rule information in the rule prompt words to obtain a serial number comparison table;

[0100] S920, obtaining the returned result of the detected target image data, and splitting the returned result according to the output format O in the BOSE framework to obtain image description information and hit rule sequence number;

[0101] S930, determining the required coding data corresponding to the returned result according to the image description information and the hit rule sequence number;

[0102] S940, collecting statistics on the demand coding data in each group of data to obtain an initial demand coding data table;

[0103] S950, judging the attribute information of each demand coding data in the initial demand coding data table, if the same detection rule in the initial demand coding data table has both forward coding data and reverse coding data, then the forward coding data of the detection rule is retained and the reverse coding data is removed, to obtain an intermediate demand coding data table;

[0104] S960, filtering the detection rules having only reverse-coded data in the intermediate demand coding data table, obtaining a final demand coding data table that does not contain demand coding data having only reverse coding, and outputting the final demand coding data table.

[0105] In this embodiment, the demand coding data is statistically matched one by one with the demand rule information in the rule prompt word, so as to determine that different serial numbers correspond to the codes of different demand rules, the returned results are split through the built-in output format, and then the split image description information is compared with the rule comparison table for the first time, so as to further verify the analysis results of the large language model, thereby improving the accuracy of the analysis results, and then the hit rule serial numbers corresponding to the image description information with correct matching results are regularly matched to determine the demand coding data involved in the analysis results of the large language model, and the demand coding data is processed to simplify the hit rules to ensure the unity of the rules in the output results, and then the reverse coding data is filtered on the intermediate demand coding data table, thereby further ensuring the accuracy of the rules corresponding to the final screened demand coding data, thereby improving the accuracy of the image processing results of the large language model.

[0106] Exemplarily, the return result of the large language model is (description Sn, 1, 2), and the hit rule numbers 1 and 2 are obtained by splitting. The hit rule numbers 1 and 2 are compared with the number comparison table. For example, in the number comparison table, the demand coding data corresponding to number 1 is a and b, and the demand coding data corresponding to number 2 is ~b and ~c. Through statistics, all the demand coding data are obtained to be a, b, ~b, and ~c. By analyzing and judging the demand coding data, it is obtained that the demand coding data b and ~b are encoded under the same detection rule, so b and ~b are offset once to obtain the demand coding data b, so the intermediate demand coding data is a, b, ~c, and because ~c is the antonym of the requirement of a certain rule, it cannot be accurately expressed as the requirement of a certain rule, so ~c is filtered, thereby ensuring the accuracy of the final coding result and improving the accuracy of the large language model in rule recognition. The final demand coding data is a and b.

[0107] In step S930, the required encoding data corresponding to the returned result is determined according to the image description information and the hit rule sequence number, including the following steps:

[0108] S931, comparing the image description information with the rule comparison table to determine whether the image description information matches the description data, and determining the rule data hit by the image description information according to the successfully matched description data, and recording it as the first rule data;

[0109] S932, comparing the hit rule serial number corresponding to the successfully matched image description information with the serial number comparison table to obtain the requirement code data corresponding to each hit rule serial number, and matching the rule comparison table according to the corresponding requirement code to obtain the second rule data;

[0110] S933, comparing the first rule data and the second rule data under the same image description information to determine whether the first rule data is the same as the second rule data;

[0111] S934, if the first rule data is the same as the second rule data, the requirement code data corresponding to the hit rule serial number is used as the requirement code data of the returned result;

[0112] S935: If the first rule data is different from the second rule data, remove the returned result.

[0113] In this embodiment, the image description information and the hit rule serial number in the returned result are used to match the rule comparison table and the serial number comparison table, so as to determine whether the detection rules corresponding to the image description information and the hit rule serial number are the same detection rules, and then the correctness of the returned result is verified, thereby improving the accuracy of the required coding data outputted in the end.

[0114] Exemplarily, for example, the return result of the large language model is (description Sn, 1, 2). By matching the description Sn with the expression data in the rule comparison table, it is obtained that the description Sn and the expression statement S1 have the same semantics, and the rule corresponding to the expression statement S1 is determined, for example, Rule 1, and the rule corresponding to the hit rule numbers 1 and 2 is Rule 2, which indicates that the large language model has a fault when performing rule analysis on the detection target image data, resulting in the description information being inconsistent with the matched rules, thereby making the returned result unreliable. If the rule corresponding to the hit rule numbers 1 and 2 is Rule 1, it indicates that the description information of the large language model is consistent with the matched detection rule, thereby improving the credibility of the returned result.

[0115] Compared with the existing prompt word optimization method for detecting image content using a large language model, the present invention improves the accuracy of the large language model in image detection.

[0116] The above are all preferred embodiments of the present application, and the protection scope of the present application is not limited thereto. Therefore, any equivalent changes made according to the structure, shape, and principle of the present application should be included in the protection scope of the present application.

Claims

1. A prompt word optimization method for detecting image content using a large language model, characterized in that: include: Obtain the user's image detection requirements and detection target image data, and input the image detection requirements into the BOSE framework to construct task information and obtain the description information of the image detection rules; Match the image detection requirements with the built-in detection rules to obtain the requirement rule information that matches the image detection requirements; Based on the large language model, the image detection requirements are re-edited to obtain the expression data; Performing demand judgment on the expression data to obtain the expression demand, and semantically comparing the expression demand with the image detection demand to determine the attribute information of the demand coding data corresponding to the expression demand and the image detection demand; If the semantics of the expression requirement and the image detection requirement are the same, the expression requirement and the image detection requirement are forward encoded; If the expression requirement is opposite to the image detection requirement in semantics, the expression requirement is reversely encoded under the same requirement rule information according to the forward encoding data of the image detection requirement to obtain reverse encoding data; wherein the requirement encoding data includes forward encoding and reverse encoding; The demand rule information is grouped based on the attention value of the built-in large language model, and each group of demand rule information is combined with the description information of the image detection rule according to the built-in output rule to obtain the prompt word data; Input the prompt word data and the detection target image data into the large language model, and detect the detection target image data according to the prompt word data to obtain the corresponding return result; The return result of the large language model is parsed to obtain the final processing result, and the final processing result is output.

2. The method for optimizing prompt words for detecting image content using a large language model according to claim 1, characterized in that: Before the step of obtaining the user's image detection requirements and detection target image data, and inputting the image detection requirements into the BOSE framework to construct task information and obtain the description information of the image detection rules, the method further includes: Perform text language judgment on the image detection requirements input by the user. If the first prompt word data input by the user is English text, the image detection requirements are input into the BOSE framework to construct prompt words. If the image detection requirement input by the user is a Chinese text, a prompt word is preliminarily written for the image detection requirement, recorded as the first prompt word data, and the first prompt word data is input into the large language model for testing to obtain a test result; If the test result meets the user's needs, the first prompt word data is translated into English prompt word data and recorded as the second prompt word data; The second prompt word data is input into the BOSE framework for prompt word construction.

3. The method for optimizing prompt words for detecting image content using a large language model according to claim 1, characterized in that: The user's image detection requirements and detection target image data are obtained, and the image detection requirements are input into the BOSE framework to construct task information, and the description information of the image detection rules is obtained, specifically: Input the image detection requirements into the natural language processing model to determine the task category, and match the corresponding role setting information according to the task category; Determine the task instructions for the large language model to detect the target image data according to the role setting information and the image detection requirements; The role setting information and task instructions are combined and output according to the built-in prompt word output standard to obtain the description information of the image detection rules used to guide the thinking of the large language model.

4. The method for optimizing prompt words for detecting image content using a large language model according to claim 3, characterized in that: The BOSE framework includes background information B, output format O, standard S and example E; The background information B is used to judge the image detection requirements to determine the role setting of the large language model when performing image processing; The output format O is used to standardize the output content format of the large language model; The standard S is used to judge the image detection requirements, determine the user's task objectives, and generate corresponding task instructions; Example E is used to generate sample return results according to role settings, task instructions and the output content format of the built-in large language model.

5. The method for optimizing prompt words for detecting image content using a large language model according to claim 4, characterized in that: The attention value based on the built-in large language model is used to group the requirement rule information, and each group of requirement rule information is combined with the description information of the image detection rule according to the built-in output rule to obtain the prompt word data, specifically: Randomly sort the demand rule information; The randomly ordered demand rule information is grouped based on the built-in attention value to obtain grouped data; Numbering the demand rule information in each grouped data to obtain a rule sequence number; Combine the rule sequence number with the expression data of the corresponding requirement rule information to obtain the rule prompt word of each group data; Based on the built-in prompt word combination specification, the description information of the image detection rule is combined with the rule prompt words of each grouping data to obtain the corresponding prompt word data.

6. The method for optimizing prompt words for detecting image content using a large language model according to claim 5, characterized in that: The prompt word data and the detection target image data are input into the large language model, and the detection target image data is detected according to the prompt word data to obtain the corresponding return result, which is specifically: The requirement coding data, expression data and requirement rule information of image detection requirements are counted one by one to obtain a rule comparison table; The large language model receives the prompt word data and performs image description on the input detection target image data according to the description information of the image detection rule in the prompt word data to obtain corresponding image description information; Semantically match the image description information with the expression data of the rule prompt word in the prompt word data to screen out the detection target image data with the same semantics as the image description information and the expression data, and match the successfully matched expression data with the rule comparison table to determine the corresponding rule number, which is recorded as the hit rule number; Based on the output format O in the BOSE framework, the image description information and the hit rule sequence number of the successfully matched detection target image data are combined and output to obtain the return result of the corresponding detection target image data.

7. The method for optimizing prompt words for detecting image content using a large language model according to claim 6, characterized in that: The return result of the large language model is parsed to obtain the final processing result, and the final processing result is output, specifically: Based on the one-to-one correspondence statistics between the demand coding data in the demand rule information and the rule serial numbers corresponding to the demand rule information in the rule prompt words, a serial number comparison table is obtained; Get the returned result of the detected target image data, and split the returned result according to the output format O in the BOSE framework to obtain the image description information and the hit rule sequence number; Determine the required coding data corresponding to the returned result according to the image description information and the hit rule sequence number; Count the demand coding data in each group data to obtain an initial demand coding data table; The attribute information of each demand coding data in the initial demand coding data table is judged. If the same detection rule in the initial demand coding data table contains both forward coding data and reverse coding data, the forward coding data of the detection rule is retained and the reverse coding data is removed to obtain an intermediate demand coding data table; The detection rules having only reverse-coded data in the intermediate demand coding data table are filtered to obtain a final demand coding data table that does not contain demand coding data having only reverse coding and output it.

8. The method for optimizing prompt words for detecting image content using a large language model according to claim 7, characterized in that: The required encoding data corresponding to the returned result is determined according to the image description information and the hit rule sequence number, specifically: Compare the image description information with the rule comparison table to determine whether the image description information matches the description data, and determine the rule data hit by the image description information based on the successfully matched description data, and record it as the first rule data; Compare the hit rule serial number corresponding to the successfully matched image description information with the serial number comparison table to obtain the requirement coding data corresponding to each hit rule serial number, and match the rule comparison table according to the corresponding requirement coding to obtain the second rule data; Comparing the first rule data with the second rule data under the same image description information to determine whether the first rule data is the same as the second rule data; If the first rule data is the same as the second rule data, the requirement code data corresponding to the hit rule serial number is used as the requirement code data of the returned result; If the first rule data is different from the second rule data, the returned result is removed.

Citation Information

Patent Citations

  • Method and device for realizing Internet harmful image detection processing based on large language model, processor and computer readable storage medium

    CN117876911A

  • Image description method and device, equipment, storage medium and product

    CN118467776A