Picture searching method and device
By acquiring image access requests and results, determining the type and size of images to be optimized, generating response results, and training a model, the problem of low image search efficiency in existing technologies is solved, achieving efficient and accurate image search and improved page loading speed.
Patent Information
- Application Number
- CN202410649957.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-23
- Publication Date
- 2025-11-25
AI Technical Summary
Existing image search methods are inefficient and prone to errors when dealing with large search volumes, failing to meet practical needs.
By acquiring image access requests and results from the target page, determining the types and sizes of images to be optimized based on image features and size data, generating response results, and training an image search model using training samples, efficient and accurate image search can be achieved.
It improved the accuracy of image search, increased page loading speed, and saved labor costs.
Smart Images

Figure CN121009243A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a method and apparatus for image search. Background Technology
[0002] In the internet business field, page loading speed directly impacts user experience, and images on a page are a crucial factor influencing page loading speed. Quickly and accurately identifying and optimizing target images that significantly impact loading speed is an effective measure to improve page loading efficiency. Current image searches typically involve manually sifting through image access request results to find the target images.
[0003] In the process of realizing this invention, the inventors discovered the following problems in the prior art: Existing image search methods are inefficient and prone to errors when dealing with large search volumes, failing to adequately meet practical needs. Summary of the Invention
[0004] In view of this, embodiments of the present invention provide a method and apparatus for image search, which achieves efficient and accurate image search, not only improving the accuracy of image search and ensuring the effect of subsequent page loading speed improvement, but also saving labor costs.
[0005] To achieve the aforementioned objective, according to one aspect of the present invention, a method for image search is provided, comprising: In response to receiving an image search request, obtain the image access request of the target page and the request result corresponding to the image access request; Based on the image features and corresponding image types of each image in the request results, determine the types of images to be optimized in the target page; Based on the size data of each image in the request results, determine the images on the target page whose sizes need to be optimized; Based on the type of image to be optimized and the size of the image to be optimized, a response result for the image search request is generated.
[0006] Optionally, before obtaining the image access request for the target page, the method further includes: determining that the image query service is enabled.
[0007] Optionally, based on the image features and corresponding image types of each image in the request results, the type of images to be optimized in the target page is determined, including: determining whether the image features and corresponding image types of each image in the request results match based on a preset correspondence between image features and image types; and designating images whose image features and image types do not match as type-optimized images.
[0008] Optionally, determining the images in the target page whose size needs optimization based on the size data of each image in the request results includes: storing the request results into a predefined array according to image dimensions to obtain an image information array, the image information array including the image server address, image type, and size data of each image; classifying and grouping the images in the image information array according to a classification strategy that uses the same server address and the same image type; and selecting images whose size data exceeds a preset size threshold as images whose size needs optimization based on the size data of the images in each group after classification and grouping.
[0009] Optionally, based on the size data of the images in each group after classification and grouping, images whose size data exceeds a preset size threshold are selected as images whose size needs to be optimized. This includes: sorting the images in each group after classification and grouping according to the size data; and obtaining the images whose size data exceeds the preset size threshold based on the sorting result.
[0010] Optionally, based on the image to be optimized by type and the image to be optimized by size, a response result for the image search request is generated, including: retrieving the thumbnail of the image to be optimized by type and querying the location information corresponding to the image to be optimized by type from the request result; retrieving the thumbnail of the image to be optimized by size and querying the location information corresponding to the image to be optimized by size from the request result; and using the thumbnail and location information corresponding to the image to be optimized by type, as well as the thumbnail and location information corresponding to the image to be optimized by size, as the response result for the image search request.
[0011] Optionally, after generating the response result of the image search request, the method further includes: constructing training samples based on the response result and the target page; training a preset initial image search model using the training samples to obtain an image search model with the ability to locate the image to be optimized, so as to use the image search model to locate the image to be optimized on the page.
[0012] According to a second aspect of the present invention, an image search apparatus is provided, comprising: The request result acquisition module is used to respond to receiving an image search request, acquire the image access request of the target page, and the request result corresponding to the image access request; The first image search module is used to determine the type of images to be optimized in the target page based on the image features and corresponding image types of each image in the request results. The second image search module is used to determine the images in the target page whose size needs to be optimized based on the size data of each image in the request results. The response result generation module is used to generate a response result for the image search request based on the type of image to be optimized and the size of the image to be optimized.
[0013] According to a third aspect of the present invention, an electronic device for image searching is provided, comprising: One or more processors; Storage device for storing one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the method provided in the first aspect of the embodiments of the present invention.
[0014] According to a fourth aspect of the present invention, a computer-readable medium is provided having a computer program stored thereon, which, when executed by a processor, implements the method provided in the first aspect of the present invention.
[0015] One embodiment of the invention has the following advantages or beneficial effects: by responding to a received image search request, obtaining the image access request of the target page and the request result corresponding to the image access request; determining the type of image to be optimized in the target page based on the image features and corresponding image types of each image in the request result; determining the size of the image to be optimized in the target page based on the size data of each image in the request result; and generating the response result of the image search request based on the type and size of the image to be optimized, the technical solution achieves efficient and accurate image search, which not only improves the accuracy of image search and ensures the effect of subsequently improving page loading speed, but also saves labor costs. Attached Figure Description
[0016] The accompanying drawings are provided to better understand the invention and are not intended to unduly limit the scope of the invention. Wherein: Figure 1 This is a schematic diagram of the main flow of the image search method according to an embodiment of the present invention; Figure 2 This is a detailed flowchart illustrating the image search method according to an embodiment of the present invention; Figure 3 This is a schematic diagram of the main modules of an image search device according to an embodiment of the present invention; Figure 4 This is an exemplary system architecture diagram in which embodiments of the present invention can be applied; Figure 5 This is a schematic diagram of the structure of a computer system suitable for implementing terminal devices or servers of the present invention. Detailed Implementation
[0017] It should be noted that the acquisition, storage, and application of user personal information involved in the technical solution disclosed herein comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0018] The following description, in conjunction with the accompanying drawings, illustrates exemplary embodiments of the present invention, including various details to aid understanding. These details should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the invention. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0019] Existing image search methods are inefficient and prone to errors when dealing with large search volumes, failing to adequately meet practical needs.
[0020] To address the aforementioned problems in existing technologies, this invention proposes an image search method. Based on the request results corresponding to the obtained image access requests, the method identifies images on the target page whose type and size require optimization, and searches for images on the target webpage that need optimization from multiple perspectives. This achieves efficient and accurate image search, not only improving the accuracy of image search and ensuring the subsequent improvement in page loading speed, but also saving labor costs.
[0021] Figure 1 This is a schematic diagram of the main flow of the image search method according to an embodiment of the present invention, such as... Figure 1 As shown, the image search method of this embodiment includes the following steps S101 to S103.
[0022] Step S101: In response to receiving an image search request, obtain the image access request of the target page and the request result corresponding to the image access request.
[0023] Specifically, page loading speed is a crucial task in website optimization, and images on a webpage are a significant factor affecting page loading speed. This invention, based on this business scenario, identifies images to be optimized on a target page, performs specific processing on these images, and ultimately improves page loading speed. When the system receives an image search request, it determines the target page for the search, obtains the access request traffic of the current target page, filters out all image access requests, and retrieves the corresponding request results. The image search method of this invention can be executed by the backend, the frontend, or a combination of both. Considering image search efficiency and reasonable resource allocation, frontend execution is preferred.
[0024] According to one embodiment of the present invention, before obtaining the image access request of the target page, the method further includes: determining that the image query service is in an enabled state.
[0025] Specifically, this embodiment of the invention provides image query as a service. To improve the adaptability of the image query service, a switch controlling the image query service is deployed at the beginning of the query process. The switch controls the state of the image query service; its value is a boolean, where true indicates the service is enabled and false indicates it is disabled. This allows the switch to be set as needed. Image queries can only be executed when the switch is set to true. Therefore, before obtaining image access requests from the target page, it is necessary to ensure that the image query service is enabled. If the image query service is not enabled, subsequent image queries cannot be performed.
[0026] Step S102: Based on the image features and corresponding image types of each image in the request results, determine the type of image to be optimized in the target page.
[0027] Specifically, the request results obtained in this embodiment of the invention include not only basic information such as the name and location of each image, but also image type (i.e., image format) and image features, such as color features and dynamic features. Understandably, an image can be stored in multiple image types, each with its own advantages; for example, the advantage of JPEG format is its good preservation of color information. To improve page loading speed, the images on the target page should use appropriate image types. Based on the image features and corresponding image types of each image in the obtained request results, a type scoring algorithm is used to calculate the image type score. Images with scores below a threshold are designated as images requiring type optimization.
[0028] According to one embodiment of the present invention, determining the type of images to be optimized in the target page based on the image features and corresponding image types of each image in the request result includes: determining whether the image features and corresponding image types of each image in the request result match based on a preset correspondence between image features and image types; and designating images whose image features and image types do not match as type-optimized images.
[0029] Specifically, considering the limited number of commonly used image types, mainly involving JPEG, PNG, WEBP, GIF, and BMP formats, each with its own advantages, a more practical method can be used to find images whose type needs optimization in order to improve search efficiency and simplify processing logic. Based on the advantages of each image type and the image's inherent characteristics, a reference table mapping image features to image types is pre-established. For example, the table could explicitly indicate that vibrant and rich colors correspond to JPEG images, while dynamic images correspond to GIF images. This reference table includes commonly used image types on the page. Therefore, it is only necessary to determine whether the image features and corresponding image types of each image in the currently retrieved request results match according to the pre-defined mapping. If they do not match, the mismatched images are designated as images whose type needs optimization.
[0030] Step S103: Based on the size data of each image in the request result, determine the image whose size needs to be optimized in the target page.
[0031] Specifically, in addition to the inappropriate image types mentioned above, another major factor affecting the loading speed of the target page is the image size. The size of the image data is related to the page loading speed. It can be understood that a large image size means a large amount of image data and a large workload for front-end rendering. Therefore, based on the specific size data of each image in the request results, images whose size data exceeds the size threshold can be selected as images whose size needs to be optimized.
[0032] According to an embodiment of the present invention, determining the images to be optimized in the target page based on the size data of each image in the request result includes: storing the request result into a predefined array according to the image dimensions to obtain an image information array, the image information array including the image server address, image type, and size data of each image; classifying and grouping the images in the image information array according to a classification strategy that uses the same server address and the same image type; and selecting images whose size data exceeds a preset size threshold as images to be optimized based on the size data of the images in each group after classification and grouping.
[0033] Specifically, considering that the request results contain rich information about each image, the size of the images alone can identify some images causing slow page loading. However, testing revealed that some smaller images also had long response times. By comparing other image parameters, a pattern emerged: under the same server address and image type, the larger the image size, the longer the response time. To more accurately determine the images on the target page that need size optimization, after obtaining the image access request results for the target page, the request results are stored in a predefined array according to image dimensions. This embodiment of the invention determines the main components of the array based on the main information types of the images in the request results.
[0034] For example, the predefined array composition is shown in the table below: Accordingly, an example of a specific image information array is as follows: const imags= [{"name": "aaa.png", "domain": "storage.360buyimg.com", "type": "png", "area": "0", "floor": "0", "location": "0,1", "size": "22"}, {"name": "bbb.png", "domain": "img11.360buyimg.com", "type": "gif", "area": "1", "floor": "1", "location": "2,1", "size": "33"}, {"name": "ccc.png", "domain": "storage.360buyimg.com", "type": "png", "area": "3", "floor": "3", "location": "0,2", "size": "44"}].
[0035] Furthermore, the image information array is grouped according to the same server address and the same image type, resulting in multiple groups. Images in each group share the same server address and image type. Then, images from each group whose size exceeds a preset size threshold are selected as images to be optimized. Understandably, the size threshold can be specific size data or the number of images to be queried. If resources are limited, the image with the largest size in each group can be selected as the image to be optimized, or the top five largest images can be selected; this embodiment of the invention does not impose specific limitations.
[0036] According to another embodiment of the present invention, selecting images whose size data exceeds a preset size threshold as images to be optimized based on the size data of the images in each group after classification and grouping includes: sorting the images in each group after classification and grouping according to the size data; and obtaining the images to be optimized whose size data exceeds the preset size threshold based on the sorting result.
[0037] Specifically, to improve image search efficiency, the images within each group after categorization are sorted according to their corresponding size data values, either in ascending or descending order. Considering that this embodiment primarily searches for images with larger size data, descending order is preferred. This allows for the rapid acquisition of all images requiring size optimization by finding those within the sorted groups whose sizes are closest to and greater than a size threshold. Understandably, a size threshold can also be set based on the number of images to be queried; for example, setting the top five largest images would select the top five images after descending sorting as the images requiring size optimization.
[0038] Step S104: Generate a response result for the image search request based on the type of image to be optimized and the size of the image to be optimized.
[0039] Specifically, based on the images of types and sizes that need optimization found above, the names of the images of types and sizes that need optimization are summarized, the summarized information is packaged according to the format requirements, and finally fed back to the requester of the image search request.
[0040] According to one embodiment of the present invention, generating a response result for the image search request based on the image to be optimized by type and the image to be optimized by size includes: retrieving a thumbnail of the image to be optimized by type and querying the location information corresponding to the image to be optimized by type from the request result; retrieving a thumbnail of the image to be optimized by size and querying the location information corresponding to the image to be optimized by size from the request result; and using the thumbnail and location information corresponding to the image to be optimized by type and the thumbnail and location information corresponding to the image to be optimized by size as the response result for the image search request.
[0041] Specifically, considering the readability of the response results, after obtaining the image of type to be optimized and the image of size to be optimized, for the image of type to be optimized, the thumbnail of the image of type to be optimized is retrieved from memory, and the location information corresponding to the image of type to be optimized is queried from the request results to obtain the thumbnail and location information corresponding to the image of type to be optimized; similarly, for the image of size to be optimized, the thumbnail of the image of size to be optimized is retrieved from memory, and the location information corresponding to the image of size to be optimized is queried from the request results to obtain the thumbnail and location information corresponding to the image of size to be optimized. Finally, the thumbnail and location information corresponding to the image of type to be optimized, and the thumbnail and location information corresponding to the image of size to be optimized are used as the response results of the image search request. The image location information in this embodiment of the invention mainly refers to the image's location information on the target page. A target page is divided into three levels of location: regional location, floor location, and specific row and column coordinates within the floor.
[0042] According to another embodiment of the present invention, after generating the response result of the image search request, the method further includes: constructing training samples based on the response result and the target page; training a preset initial image search model through the training samples to obtain an image search model with the ability to locate the image to be optimized, so as to use the image search model to locate the image to be optimized in the page.
[0043] Specifically, based on the image search method described above, images of types and sizes requiring optimization are found. Considering the excellent learning ability and high execution efficiency of the large model, after generating the response result of the image search request, the obtained image search response result and target page are standardized and labeled to construct training samples. The constructed training samples are used to train a preset image search initial model. Through feature extraction from the response result and target page, and through learning, the image search initial model obtains an image search model that can locate the images requiring optimization from the page.
[0044] Furthermore, the image search method described above can also be used for image search within the entire application (APP). By integrating the image search method into an image search component and connecting the image search component to the application (APP) or a specific business line, automatic image search and location can be achieved, realizing efficient, convenient, and intelligent image search, which is more convenient for promotion and application.
[0045] Figure 2This is a detailed flowchart illustrating the image search method according to an embodiment of the present invention. Upon receiving an image query request, it is determined whether the image query service is enabled. If disabled, image searching is not allowed; it can only be performed when enabled. After confirming the enabled status, the image access request from the target page and the corresponding request result are obtained. Based on the request result, images requiring type optimization and images requiring size optimization are queried from the target page: For images requiring type optimization, a preset correspondence between image features and image types is obtained, and the images requiring type optimization are obtained by determining whether the image features and corresponding image types of each image in the request result match; for images requiring size optimization, the request result is stored in a predefined array according to image dimensions. The images in the array are categorized and grouped according to their server address and image type. The size data of the images in each group is then sorted in descending order. Based on the sorting result, images requiring size optimization are obtained. Based on the images requiring type and size optimization, a response result is generated containing thumbnails and location information of the images requiring type optimization, as well as thumbnails and location information of the images requiring size optimization. Finally, training samples are built based on the response results and the corresponding target pages. The initial image search model is trained using the training samples to obtain the image search model. The mature image search model is then modularized to obtain the image search component. The image search component is then applied to the APP or a specified business line to automatically find and locate the image to be optimized.
[0046] This invention, through fully automated image searching of a target page, quickly and accurately retrieves images to be optimized, thereby accelerating loading based on the found images. Furthermore, the invention's control over the image search service ensures good adaptability, allowing for image search to be enabled or disabled according to business needs, thus accommodating a wider range of usage scenarios. Additionally, the intelligent, component-based extended design further promotes the widespread application of this method.
[0047] Figure 3 This is a schematic diagram of the main modules of an image search device according to an embodiment of the present invention. Figure 3 As shown, the image search device 300 mainly includes a request result acquisition module 301, an image search first module 302, an image search second module 303, and a response result generation module 304.
[0048] The request result acquisition module 301 is used to, in response to receiving an image search request, acquire the image access request of the target page and the request result corresponding to the image access request; The first image search module 302 is used to determine the type of image to be optimized in the target page based on the image features and corresponding image types of each image in the request results. The second image search module 303 is used to determine the images in the target page whose size needs to be optimized based on the size data of each image in the request results. The response result generation module 304 is used to generate a response result for the image search request based on the type of image to be optimized and the size of the image to be optimized.
[0049] According to one embodiment of the present invention, the image search device 300 further includes a state determination module (not shown in the figure), used to: determine that the image search service is in an enabled state before obtaining an image access request for the target page.
[0050] According to another embodiment of the present invention, the first image search module 302 is further configured to: determine whether the image features and corresponding image types of each image in the request result match according to a preset correspondence between image features and image types; and designate images whose image features and image types do not match as images whose types need to be optimized.
[0051] According to another embodiment of the present invention, the second image search module 303 is further configured to: store the request result into a predefined array according to the image dimensions to obtain an image information array, the image information array including the image server address, image type, and size data of each image; classify and group the images in the image information array according to a classification strategy that uses the same server address and the same image type; and select images whose size data exceeds a preset size threshold as images whose size needs to be optimized based on the size data of the images in each group after classification and grouping.
[0052] According to another embodiment of the present invention, the second image search module 303 is further configured to: sort the images in each group after classification and grouping according to the size data; and, based on the sorting result, obtain the images to be optimized whose size data exceeds a preset size threshold.
[0053] According to another embodiment of the present invention, the response result generation module 304 is further configured to: retrieve the thumbnail of the image to be optimized of the type, and query the location information corresponding to the image to be optimized of the type from the request result; retrieve the thumbnail of the image to be optimized of the size, and query the location information corresponding to the image to be optimized of the size from the request result; and use the thumbnail and location information corresponding to the image to be optimized of the type, and the thumbnail and location information corresponding to the image to be optimized of the size, as the response result of the image search request.
[0054] According to another embodiment of the present invention, the image search apparatus 300 further includes a model building module (not shown in the figure), configured to: after generating a response result of the image search request, construct training samples based on the response result and the target page; train a preset image search initial model through the training samples to obtain an image search model with the ability to locate the image to be optimized, so as to use the image search model to locate the image to be optimized in the page.
[0055] Figure 4 This is an exemplary system architecture diagram in which embodiments of the present invention can be applied.
[0056] like Figure 4 As shown, system architecture 400 may include terminal devices 401, 402, and 403, a network 404, and a server 405. Network 404 serves as the medium for providing communication links between terminal devices 401, 402, and 403 and server 405. Network 404 may include various connection types, such as wired or wireless communication links, or fiber optic cables, etc.
[0057] Users can use terminal devices 401, 402, and 403 to interact with server 405 via network 404 to receive or send messages, etc. Various communication client applications, such as image search applications, can be installed on terminal devices 401, 402, and 403 (for example only).
[0058] Terminal devices 401, 402, and 403 can be various electronic devices with displays that support web browsing, including but not limited to smartphones, tablets, laptops, and desktop computers.
[0059] Server 405 can be a server providing various services, such as a backend management server supporting image searches performed by users using terminal devices 401, 402, and 403 (this is just an example). The backend management server can, in response to receiving an image search request, obtain the image access request for the target page and the corresponding request result; determine the type of image to be optimized in the target page based on the image characteristics and corresponding image types of each image in the request result; determine the size of the image to be optimized in the target page based on the size data of each image in the request result; generate a response result for the image search request based on the type and size of the image to be optimized, and then feed the processing result back to the terminal device.
[0060] It should be noted that the image search method provided in this embodiment of the invention is generally executed by server 405, and correspondingly, the image search device is generally set in server 405.
[0061] It should be understood that Figure 4 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.
[0062] The following is for reference. Figure 5 It shows a schematic diagram of the structure of a computer system suitable for implementing terminal devices or servers of the present invention. Figure 5 The terminal device or server shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of the present invention.
[0063] like Figure 5 As shown, the computer system 500 includes a central processing unit (CPU) 501, which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 502 or programs loaded from storage section 508 into random access memory (RAM) 503. The RAM 503 also stores various programs and data required for the operation of the system 500. The CPU 501, ROM 502, and RAM 503 are interconnected via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0064] The following components are connected to I / O interface 505: an input section 506 including a keyboard, mouse, etc.; an output section 507 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 508 including a hard disk, etc.; and a communication section 509 including a network interface card such as a LAN card, modem, etc. The communication section 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to I / O interface 505 as needed. A removable medium 511, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on drive 510 as needed so that computer programs read from it can be installed into storage section 508 as needed.
[0065] In particular, according to the embodiments disclosed in this invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this invention include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 509, and / or installed from removable medium 511. When the computer program is executed by central processing unit (CPU) 501, it performs the functions defined above in the system of this invention.
[0066] It should be noted that the computer-readable medium shown in this invention can be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this invention, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media can also be any computer-readable medium other than computer-readable storage media, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.
[0067] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0068] The units described in the embodiments of the present invention can be implemented in software or in hardware. The described units can also be housed in a processor; for example, a processor can be described as including: a request result acquisition module, an image search first module, an image search second module, and a response result generation module.
[0069] In some cases, the names of these modules do not constitute a limitation on the module itself. For example, the response result generation module can also be described as "a module for generating a response result for the image search request based on the type of image to be optimized and the size of the image to be optimized".
[0070] On the other hand, the present invention also provides a computer-readable medium, which may be included in the device described in the embodiments; or it may exist independently and not assembled into the device. The computer-readable medium carries one or more programs, which, when executed by the device, cause the device to include: in response to receiving an image search request, obtaining an image access request for a target page and a request result corresponding to the image access request; determining images of type to be optimized in the target page based on image features and corresponding image types of each image in the request result; determining images of size to be optimized in the target page based on size data of each image in the request result; and generating a response result for the image search request based on the images of type to be optimized and the images of size to be optimized.
[0071] The technical solution of the present invention has the following advantages or beneficial effects: by responding to a received image search request, obtaining the image access request of the target page and the request result corresponding to the image access request; determining the type of image to be optimized in the target page based on the image features and corresponding image types of each image in the request result; determining the size of the image to be optimized in the target page based on the size data of each image in the request result; and generating the response result of the image search request based on the type and size of the image to be optimized, the technical solution achieves efficient and accurate image search, which not only improves the accuracy of image search and ensures the effect of subsequently improving page loading speed, but also saves labor costs.
[0072] The specific embodiments described herein do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can occur depending on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A method for image search, characterized in that, include: In response to receiving an image search request, obtain the image access request of the target page and the request result corresponding to the image access request; Based on the image features and corresponding image types of each image in the request results, determine the types of images to be optimized in the target page; Based on the size data of each image in the request results, determine the images on the target page whose sizes need to be optimized; Based on the type of image to be optimized and the size of the image to be optimized, a response result for the image search request is generated.
2. The method according to claim 1, characterized in that, Before obtaining the image access request for the target page, the method further includes: The image search service is confirmed to be enabled.
3. The method according to claim 1, characterized in that, Based on the image features and corresponding image types of each image in the request results, determine the types of images in the target page that need optimization, including: Based on the preset correspondence between image features and image types, determine whether the image features and corresponding image types of each image in the request result match; Images whose image features and image types do not match are classified as images requiring type optimization.
4. The method according to claim 1, characterized in that, Based on the size data of each image in the request results, determine the images on the target page whose sizes need to be optimized, including: The request results are stored in a predefined array according to the image dimensions to obtain an image information array, which includes the image server address, image type, and size data of each image. Based on the classification strategy of having the same server address and the same image type, the images in the image information array are classified and grouped. Based on the size data of the images in each group after classification, images whose size data exceeds the preset size threshold are selected as images whose size needs to be optimized.
5. The method according to claim 4, characterized in that, Based on the image size data of each group after classification, images whose size data exceeds a preset size threshold are selected as images whose size needs to be optimized, including: Sort the images in each group according to their size data; Based on the sorting results, images whose size data exceeds the preset size threshold are selected for optimization.
6. The method according to claim 1, characterized in that, Based on the image to be optimized by type and the image to be optimized by size, generate a response result for the image search request, including: Retrieve thumbnails of the images of the specified type to be optimized, and query the location information corresponding to the images of the specified type to be optimized from the request results; Retrieve the thumbnail of the image whose size needs to be optimized, and query the location information corresponding to the image whose size needs to be optimized from the request results; The thumbnail and location information of the image to be optimized of the specified type, and the thumbnail and location information of the image to be optimized in terms of size, are used as the response results of the image search request.
7. The method according to claim 1, characterized in that, After generating the response result of the image search request, the method further includes: Based on the response results and the target page, training samples are constructed; By training a preset initial image search model using the training samples, an image search model with the ability to locate images to be optimized is obtained, so that the image search model can be used to locate images to be optimized on the page.
8. A device for image search, characterized in that, include: The request result acquisition module is used to respond to receiving an image search request, acquire the image access request of the target page, and the request result corresponding to the image access request; The first image search module is used to determine the type of images to be optimized in the target page based on the image features and corresponding image types of each image in the request results. The second image search module is used to determine the images in the target page whose size needs to be optimized based on the size data of each image in the request results. The response result generation module is used to generate a response result for the image search request based on the type of image to be optimized and the size of the image to be optimized.
9. A mobile electronic device terminal, characterized in that, include: One or more processors; Storage device for storing one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in any one of claims 1-7.
10. A computer-readable medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1-7.
Citation Information
Patent Citations
Webpage picture checking method and device as well as computing device
CN104573023A
Picture display optimization method and apparatus
CN106599023A
Picture positioning method and device, electronic equipment and computer readable storage medium
CN112926578A
Picture display optimization method, system and equipment and storage medium
CN113836452A
Picture loading method and device, computer equipment and storage medium
CN114896534A