Browser-based image detection method, device, equipment, and storage medium

By running the converted picture detection model on the browser side, the problem of low efficiency of online medical picture detection is solved and fast picture detection is achieved.

CN114596305BActive Publication Date: 2025-08-19KANG JIAN INFORMATION TECH (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210283726.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-22
Publication Date
2025-08-19
Estimated Expiration
2042-03-22

AI Technical Summary

Technical Problem

Currently, online medical image detection efficiency is low, mainly because the image scale is too large and multiple servers need to be deployed, the detection speed is slow and images need to be transmitted over the network for processing.

Method used

The image detection model is converted into a wasm file format through the Emscripten compiler, so that it runs on the browser side, and the model is imported and instantiated using tensorflow, and image detection is performed directly on the browser side to avoid network transmission.

Benefits of technology

It improves the efficiency of online medical picture detection, shortens detection time, and reduces network transmission delay.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114596305B_ABST
    Figure CN114596305B_ABST
Patent Text Reader

Abstract

The present invention relates to artificial intelligence technology and discloses a browser-based image detection method, comprising: compiling a preset image detection model based on the Emscripten compiler to obtain a target image detection model in a wasm file format; upon receiving an image to be detected input by a user through a browser, importing the wasm file corresponding to the target image detection model through tensorflow, and instantiating the target image detection model on the browser side; performing image detection on the image to be detected using the target image detection model, obtaining an image detection conclusion, and displaying the image detection conclusion on the browser. The present invention also proposes a browser-based image detection device, electronic device, and storage medium. The present invention can improve the efficiency of online medical image detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a browser-based image detection method, device, electronic device, and computer-readable storage medium. Background Art

[0002] With the continuous development of AI technology, more and more problems can be pre-processed using AI. For example, detecting skin problems through AI image recognition is currently a major application scenario for online diagnosis and treatment assistance. Patients send skin pictures to doctors through online diagnosis and treatment platforms, and the doctors send the pictures to the AI image detection server for image detection.

[0003] Most current AI technologies use APIs, with servers providing data to clients. This approach has the following drawbacks: When the image size required for testing is large, sufficient computing power must be deployed on numerous servers, leading to slower detection speeds. Furthermore, images must be sent to AI servers over the network for processing, and the results are then transmitted back to the client, resulting in a relatively long detection time. Consequently, current online medical image testing is inefficient. Summary of the Invention

[0004] The present invention provides a browser-based image detection method, device and computer-readable storage medium, the main purpose of which is to solve the problem of low efficiency of online medical image detection.

[0005] To achieve the above objectives, the present invention provides a browser-based image detection method, comprising:

[0006] Compile the preset image detection model based on the Emscripten compiler to obtain the target image detection model in the wasm file format;

[0007] When receiving the image to be detected input by the user through the browser, the wasm file corresponding to the target image detection model is imported through tensorflow, and the target image detection model is instantiated on the browser side;

[0008] The target image detection model is used to perform image detection on the image to be detected, to obtain an image detection conclusion, and the image detection conclusion is displayed in the browser.

[0009] Optionally, compiling a preset image detection model based on an Emscripten compiler to obtain a target image detection model in a wasm file format includes:

[0010] Optimize the code of the preset image detection model to obtain the target code of the image detection model;

[0011] The image detection model target code is compiled using the Emscripten compiler compilation tool to obtain the target image detection model in the wasm file format.

[0012] Optionally, the code optimization of the preset image detection model to obtain the image detection model target code includes:

[0013] Changing the synchronous scheduling code of the system layer in the preset image detection model to an asynchronous scheduling code;

[0014] Rewrite the process scheduling code in the preset image detection model into a worker thread;

[0015] Extracting the image detection core algorithm in the preset image detection model;

[0016] The asynchronous scheduling code, the worker thread and the image detection core algorithm are combined into an image detection model target code.

[0017] Optionally, compiling the image detection model target code using an Emscripten compiler tool to obtain a target image detection model in a wasm file format includes:

[0018] Compile the asynchronous scheduling code and the image detection core algorithm in the image detection model target code based on the Emscripten compiler tool to generate intermediate code, and convert the intermediate code into wasm assembly code;

[0019] Merge the worker thread and wasm assembly code in the target code of the image detection model to generate a wasm file of the target image detection model.

[0020] Optionally, instantiating the target image detection model on the browser side includes:

[0021] Remotely load the wasm file of the target image detection model based on a preset API interface;

[0022] Load the wasm instance object of the target image detection model based on the wasm file;

[0023] The target image detection model in the wasm file is called using the wasm instance object.

[0024] Optionally, performing image detection on the image to be detected using the target image detection model to obtain an image detection conclusion includes:

[0025] Extracting a facial image from the image to be detected;

[0026] Dividing the facial image into seven target areas;

[0027] The target image detection model is used to predict the skin quality of each image block to obtain an image detection conclusion.

[0028] Optionally, before compiling the preset image detection model based on the Emscripten compiler, the method further includes:

[0029] Constructing a training set for the image detection model, labeling the facial images in the training set, and obtaining a true skin quality conclusion for each facial image in the training set;

[0030] Use convolutional neural networks to build image detection models;

[0031] Using the image detection model to perform skin quality detection on each facial image in the image detection model training set, to obtain a detection result for each facial image;

[0032] A preset loss function is used to calculate the loss value between the detection result of the facial image and the true skin quality conclusion of the facial image, and the parameters of the image detection model are adjusted according to the loss value until the loss value is less than a preset loss threshold, thereby obtaining a preset image detection model.

[0033] In order to solve the above problems, the present invention further provides a browser-based image detection device, the device comprising:

[0034] The model compilation module is used to compile the preset image detection model based on the Emscripten compiler to obtain the target image detection model in the wasm file format;

[0035] The model instantiation module is used to import the wasm file corresponding to the target image detection model through tensorflow when receiving the image to be detected input by the user through the browser, and instantiate the target image detection model on the browser side;

[0036] The image detection module is used to perform image detection on the image to be detected using the target image detection model, obtain an image detection conclusion, and display the image detection conclusion in the browser.

[0037] In order to solve the above problem, the present invention further provides an electronic device, comprising:

[0038] at least one processor; and,

[0039] a memory communicatively connected to the at least one processor; wherein,

[0040] The memory stores a computer program that can be executed by the at least one processor. The computer program is executed by the at least one processor so that the at least one processor can perform the above-mentioned browser-based image detection method.

[0041] In order to solve the above problem, the present invention also provides a computer-readable storage medium, in which at least one computer program is stored. The at least one computer program is executed by a processor in an electronic device to implement the above-mentioned browser-based image detection method.

[0042] The embodiment of the present invention compiles a preset image detection model based on the Emscripten compiler to obtain a target image detection model in wasm format, which can enable the image detection model to run in a browser; imports the wasm file corresponding to the target image detection model through tensorflow, and instantiates the target image detection model on the browser side; uses the target image detection model to perform image detection on the image to be processed, obtains an image detection conclusion, and displays the image detection conclusion on the browser side; the browser directly loads the target image detection model locally to perform image detection, shortening the image detection time and improving the efficiency of current online medical image detection. Therefore, the browser-based image detection method, device, electronic device and computer-readable storage medium proposed in the present invention can solve the problem of low efficiency of online medical image detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] Figure 1 A flowchart of a browser-based image detection method provided by one embodiment of the present invention;

[0044] Figure 2 for Figure 1 A schematic diagram of a detailed implementation flow of one of the steps in the browser-based image detection method is shown;

[0045] Figure 3 A functional module diagram of a browser-based image detection device provided by one embodiment of the present invention;

[0046] Figure 4 A schematic structural diagram of an electronic device for implementing the browser-based image detection method provided by an embodiment of the present invention.

[0047] The purpose, features and advantages of the present invention will be further described with reference to the accompanying drawings and in conjunction with the embodiments. DETAILED DESCRIPTION

[0048] It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.

[0049] The embodiment of the present application provides a browser-based image detection method. The execution subject of the browser-based image detection method includes but is not limited to at least one of the electronic devices such as the server, the terminal, etc. that can be configured to execute the method provided by the embodiment of the present application. In other words, the browser-based image detection method can be executed by software or hardware installed on the terminal device or the server device, and the software can be a blockchain platform. The server includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, etc. The server can be an independent server, or it can be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.

[0050] Reference Figure 1 FIG. 1 is a flow chart of a browser-based image detection method according to an embodiment of the present invention. In this embodiment, the browser-based image detection method includes:

[0051] S1. Compile the preset image detection model based on the Emscripten compiler to obtain the target image detection model in the wasm file format.

[0052] In this embodiment of the present invention, the Emscripten compiler is an architecture compiler used to compile non-JavaScript programming languages, such as static programming languages like C, C++, and Rust, into JavaScript, simplifying the reuse of C, C++, and other code in web browsers. This embodiment of the present invention compiles a preset image detection model based on the Emscripten compiler to convert a code model written in a programming language like C++ into JavaScript that can be run by a browser, thereby obtaining a target image detection model in the wasm file format.

[0053] Furthermore, the wasm (also known as: WebAssembly) file format is a coding format that can be run in a browser, wherein the wasm file format is a binary instruction format of a stack-based virtual machine.

[0054] In an embodiment of the present invention, a convolutional neural network may be used to construct the preset image detection model, wherein the convolutional neural network includes, but is not limited to, AlexNet network, ZFNet network, VGGNet network, ResNet50 and GoogLeNet network, etc.

[0055] In one embodiment of the present invention, the preset image detection model is constructed using a GoogLeNet network, and the GoogLeNet network can be composed of a convolutional layer, a pooling layer, and a fully connected layer.

[0056] In detail, before compiling the preset image detection model based on the Emscripten compiler in S1, the method further includes:

[0057] Constructing a training set for the image detection model, labeling the facial images in the training set, and obtaining a true skin quality conclusion for each facial image in the training set;

[0058] Use convolutional neural networks to build image detection models;

[0059] Using the image detection model to perform skin quality detection on each facial image in the image detection model training set, to obtain a detection result for each facial image;

[0060] A preset loss function is used to calculate the loss value between the detection result of the facial image and the true skin quality conclusion of the facial image, and the parameters of the image detection model are adjusted according to the loss value until the loss value is less than a preset loss threshold, thereby obtaining a preset image detection model.

[0061] In one embodiment of the present invention, the training set contains facial images with typical features of eight categories: sensitivity, moisture, oil, acne, sebum, pores, pigmentation, and wrinkles. Among them, the typical features of sensitivity include the features of the forehead, cheeks, and nose wings; the typical features of moisture include the roughness of skin texture; the typical features of oil include the features of the proportion of reflective areas on the forehead, cheeks, and nose wings; the typical features of acne include the number of post-acne erythema, depressed scars, papules, pustules, and cysts; the typical features of sebum include the number of whiteheads and blackheads; the typical features of pores include the number and proportion of pores; the typical features of pigmentation include the color depth and area size of spots on the forehead, cheeks, corners of the eyes, nose wings, and chin; the typical features of wrinkles include the number, length, and depth of wrinkles on the forehead, cheeks, and corners of the eyes.

[0062] In an embodiment of the present invention, using the image detection model to predict skin quality for each facial image in the image detection model training set to obtain a prediction result for each facial image includes: obtaining a target area of the facial image in the training set; performing convolution operations, maximum pooling, and full connection operations on the target area of the facial image at multiple scales to extract features of the target area; and classifying the features of the target area to obtain a prediction result for each facial image.

[0063] The target areas include the following seven target areas: left cheek, right cheek, nose wing, chin, forehead, left corner of the eye, and right corner of the eye.

[0064] Furthermore, the preset image detection model is compiled based on the Emscripten compiler described in S1 to obtain the target image detection model in the wasm file format, including:

[0065] Optimize the code of the preset image detection model to obtain the target code of the image detection model;

[0066] The image detection model target code is compiled using the Emscripten compiler compilation tool to obtain the target image detection model in the wasm file format.

[0067] Specifically, the code optimization of the preset image detection model to obtain the image detection model target code includes:

[0068] Changing the synchronous scheduling code of the system layer in the preset image detection model to an asynchronous scheduling code;

[0069] Rewrite the process scheduling code in the preset image detection model into a worker thread;

[0070] Extracting the image detection core algorithm in the preset image detection model;

[0071] The asynchronous scheduling code, the worker thread and the image detection core algorithm are combined into an image detection model target code.

[0072] Furthermore, the Emscripten compiler tool is used to compile the image detection model target code to obtain a target image detection model in a wasm file format, including:

[0073] Compile the asynchronous scheduling code and the image detection core algorithm in the image detection model target code based on the Emscripten compiler tool to generate intermediate code, and convert the intermediate code into wasm assembly code;

[0074] Merge the worker thread and wasm assembly code in the target code of the image detection model to generate a wasm file of the target image detection model.

[0075] In this embodiment of the present invention, the synchronous scheduling code at the system level in the preset image detection model is replaced with asynchronous scheduling code, and the wasm file is called asynchronously. This embodiment of the present invention can include multiple worker threads, which are called asynchronously simultaneously. Each worker thread can process one of the images to be processed, allowing for simultaneous processing of multiple facial images of a patient, thereby improving the efficiency of image detection.

[0076] S2. When receiving the image to be detected input by the user through the browser, import the wasm file corresponding to the target image detection model through tensorflow, and instantiate the target image detection model on the browser side.

[0077] In the embodiment of the present invention, the image to be detected can be provided by a device with a shooting function, such as a mobile phone or a camera.

[0078] Furthermore, the embodiment of the present invention can utilize an image quality assessment model to perform quality assessment on the image to be detected, and delete unqualified images such as those with poor illumination, blur, or excessive offset angle, thereby improving the accuracy of image detection.

[0079] In the embodiment of the present invention, the tensorflow is a symbolic mathematical system based on dataflow programming, which is widely used in the programming implementation of various machine learning algorithms.

[0080] In one embodiment of the present invention, tensorflow.js can be used as a deep learning framework, and the deep learning algorithm library can be directly imported. The training result set is stored in the corresponding wasm library and can be reused, realizing single-platform training and multi-platform use.

[0081] For details, see Figure 2 As shown, the target image detection model is instantiated on the browser side as described in S2, including:

[0082] S21. Remotely load the wasm file of the target image detection model based on a preset API interface;

[0083] S22. Load the wasm instance object of the target image detection model based on the wasm file;

[0084] S23. Use the wasm instance object to call the target image detection model in the wasm file.

[0085] In an embodiment of the present invention, the preset API interface may be a fetch API, which provides a JavaScript interface and a global function: fetch(), which asynchronously obtains resources across the network, is used to access and manipulate HTTP requests and responses, and can directly load wasm files remotely.

[0086] In an embodiment of the present invention, the target image detection model is exported from the wasm library through tensorflow and loaded on the browser side. There is no need to transmit the image to the server or perform image detection on the server side. Instead, image detection is performed directly on the browser side, thereby improving the efficiency of image detection.

[0087] S3. Perform image detection on the image to be detected using the target image detection model to obtain an image detection conclusion, and display the image detection conclusion on the browser.

[0088] In detail, the step of performing image detection on the image to be detected using the target image detection model in S3 to obtain an image detection conclusion includes:

[0089] Extracting a facial image from the image to be detected;

[0090] Dividing the facial image into seven target areas;

[0091] The target image detection model is used to predict the skin quality of each image block to obtain an image detection conclusion.

[0092] In an embodiment of the present invention, a face recognition tool face++ can be used to perform face recognition, extract the facial image of the image to be detected, and obtain key points of the facial image; based on the key points, the facial image is divided into seven target areas.

[0093] In the embodiment of the present invention, the seven target areas are: left cheek, right cheek, nose wing, chin, forehead, left corner of the eye, and right corner of the eye.

[0094] In the embodiment of the present invention, the key points include: a left key point located on the left side of the face, a right key point located on the right side of the face, and a middle key point located in the middle of the face. The left key points include: the left forehead, the left and right edges of the left eyebrow, the left bottom eye point, the left eye corner, the left nose wing point, the left cheekbone point, the left hairline point, the left corner of the mouth, and the left chin point; the right key points include: the right forehead, the left and right edges of the right eyebrow, the right bottom eye point, the right eye corner, the right nose wing point, the right cheekbone point, the right hairline point, the right corner of the mouth, and the right chin point; and the middle key points include: the middle hairline point, the nose tip, the center of the eyebrows, the middle chin point, and the left and right brow peaks.

[0095] Specifically, the left cheek area is determined according to the left eye base point, the left mouth corner point of the left cheek, the left nose wing point, and the left eye corner point; the right cheek area is determined according to the right eye base point, the right mouth corner point of the right cheek, the right nose wing point, and the right eye corner point; the nose wing area is determined according to the eyebrow center, the nose tip, the left nose wing point, and the right nose wing point; the chin area is determined according to the left mouth corner point, the left chin point, the right mouth corner point, and the right chin point; the forehead area is determined according to the left hairline point, the right hairline point, the middle hairline point, and the left and right brow peak points; the left eye corner area is determined according to the left hairline point and the left eye corner point; and the right eye corner area is determined according to the right hairline point and the right eye corner point.

[0096] In an embodiment of the present invention, the facial image is divided into seven target areas, and prediction is performed based on the skin characteristics of each target area, thereby more accurately predicting the skin quality conclusion of the patient to be treated.

[0097] Furthermore, the embodiment of the present invention can directly display the image detection conclusion on the browser side, without having to pass through the server through the network to transmit the image detection conclusion back to the browser, saving processing time and further improving the efficiency of front-line medical image detection.

[0098] The embodiment of the present invention compiles a preset image detection model based on the Emscripten compiler to obtain a target image detection model in wasm format, which can enable the image detection model to run in a browser; imports the wasm file corresponding to the target image detection model through tensorflow, and instantiates the target image detection model on the browser side; uses the target image detection model to perform image detection on the image to be processed, obtains an image detection conclusion, and displays the image detection conclusion on the browser side; the browser directly loads the target image detection model to the local computer to perform image detection, shortening the image detection time and improving the efficiency of current online medical image detection. Therefore, the browser-based image detection method proposed in the present invention can solve the problem of low efficiency of online medical image detection.

[0099] like Figure 3 , which is a functional module diagram of a browser-based image detection device provided by an embodiment of the present invention.

[0100] The browser-based image detection device 100 of the present invention can be installed in an electronic device. Depending on the functionality implemented, the browser-based image detection device 100 can include a model compilation module 101, a model instantiation module 102, and an image detection module 103. A module, also referred to as a unit, is a series of computer program segments that can be executed by an electronic device processor and perform a fixed function, and is stored in the memory of the electronic device.

[0101] In this embodiment, the functions of each module / unit are as follows:

[0102] The model compilation module 101 is used to compile a preset image detection model based on the Emscripten compiler to obtain a target image detection model in a wasm file format;

[0103] The model instantiation module 102 is configured to, upon receiving an image to be detected input by a user through a browser, import the wasm file corresponding to the target image detection model through tensorflow and instantiate the target image detection model on the browser side;

[0104] The image detection module 103 is used to perform image detection on the image to be detected using the target image detection model, obtain an image detection conclusion, and display the image detection conclusion in the browser.

[0105] In detail, each module in the browser-based image detection device 100 according to the embodiment of the present invention adopts the same Figures 1 to 3 The browser-based image detection method described in

[15] has the same technical means and can produce the same technical effects, so I will not go into details here.

[0106] like Figure 4 FIG. 1 is a schematic diagram of the structure of an electronic device for implementing a browser-based image detection method provided by an embodiment of the present invention.

[0107] The electronic device 1 may include a processor 10, a memory 11, a communication bus 12, and a communication interface 13. It may also include a computer program stored in the memory 11 and executable on the processor 10, such as a browser-based image detection program.

[0108] In some embodiments, the processor 10 may be composed of an integrated circuit, for example, a single packaged integrated circuit, or a plurality of packaged integrated circuits with the same or different functions, including a combination of one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and various control chips. The processor 10 is the control core (Control Unit) of the electronic device, connecting the various components of the entire electronic device using various interfaces and lines, and executing or executing programs or modules stored in the memory 11 (for example, executing a browser-based image detection program, etc.), as well as calling data stored in the memory 11, to execute various functions of the electronic device and process data.

[0109] The memory 11 includes at least one type of readable storage medium, and the readable storage medium includes a flash memory, a mobile hard disk, a multimedia card, a card-type memory (for example, an SD or DX memory, etc.), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the memory 11 can be an internal storage unit of an electronic device, such as a mobile hard disk of the electronic device. In other embodiments, the memory 11 can also be an external storage device of an electronic device, such as a plug-in mobile hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device. Furthermore, the memory 11 can also include both an internal storage unit of the electronic device and an external storage device. The memory 11 can not only be used to store application software and various types of data installed in the electronic device, such as the code of a browser-based image detection program, but can also be used to temporarily store data that has been output or is to be output.

[0110] The communication bus 12 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. The bus is configured to enable communication between the memory 11 and at least one processor 10, etc.

[0111] The communication interface 13 is used for communication between the above-mentioned electronic device and other devices, including a network interface and a user interface. Optionally, the network interface may include a wired interface and / or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is generally used to establish a communication connection between the electronic device and other electronic devices. The user interface may be a display (Display), an input unit (such as a keyboard (Keyboard)), optionally, the user interface may also be a standard wired interface, a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, and an OLED (Organic Light-Emitting Diode, organic light-emitting diode) touch device, etc. Among them, the display may also be appropriately referred to as a display screen or a display unit, which is used to display information processed in the electronic device and to display a visual user interface.

[0112] Figure 4 Only the electronic device with components is shown, and it can be understood by those skilled in the art that Figure 4 The structure shown does not constitute a limitation on the electronic device 1 , and may include fewer or more components than shown in the figure, or combine certain components, or arrange the components differently.

[0113] For example, although not shown, the electronic device may further include a power source (such as a battery) for powering various components. Preferably, the power source may be logically connected to the at least one processor 10 via a power management device, thereby implementing functions such as charge management, discharge management, and power consumption management through the power management device. The power source may further include any components such as one or more DC or AC power sources, a recharging device, a power failure detection circuit, a power converter or inverter, a power status indicator, etc. The electronic device may further include various sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be described in detail here.

[0114] It should be understood that the embodiment is for illustration only and the scope of the patent application is not limited to this structure.

[0115] The browser-based image detection program stored in the memory 11 of the electronic device 1 is a combination of multiple instructions. When running in the processor 10, it can achieve the following:

[0116] Compile the preset image detection model based on the Emscripten compiler to obtain the target image detection model in the wasm file format;

[0117] When receiving the image to be detected input by the user through the browser, the wasm file corresponding to the target image detection model is imported through tensorflow, and the target image detection model is instantiated on the browser side;

[0118] The target image detection model is used to perform image detection on the image to be detected, to obtain an image detection conclusion, and the image detection conclusion is displayed in the browser.

[0119] Specifically, the specific implementation method of the processor 10 for the above instructions can refer to the description of the relevant steps in the corresponding embodiment of the accompanying drawings, which will not be repeated here.

[0120] Furthermore, if the modules / units integrated into the electronic device 1 are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. The computer-readable storage medium can be volatile or non-volatile. For example, the computer-readable medium can include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a mobile hard drive, a magnetic disk, an optical disk, a computer memory, or a read-only memory (ROM).

[0121] The present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program. When the computer program is executed by a processor of an electronic device, the computer program can implement:

[0122] Compile the preset image detection model based on the Emscripten compiler to obtain the target image detection model in the wasm file format;

[0123] When receiving the image to be detected input by the user through the browser, the wasm file corresponding to the target image detection model is imported through tensorflow, and the target image detection model is instantiated on the browser side;

[0124] The target image detection model is used to perform image detection on the image to be detected, to obtain an image detection conclusion, and the image detection conclusion is displayed in the browser.

[0125] In the several embodiments provided by the present invention, it should be understood that the disclosed devices, apparatuses, and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the module division is merely a logical function division, and other division methods may be used in actual implementation.

[0126] The modules described as separate components may or may not be physically separate, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed across multiple network elements. Some or all of the modules may be selected to achieve the purpose of the solution of this embodiment according to actual needs.

[0127] In addition, the functional modules in various embodiments of the present invention may be integrated into a single processing unit, each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or hardware plus software functional modules.

[0128] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.

[0129] Therefore, the embodiments should be considered in all respects as illustrative and non-restrictive, and the scope of the invention is defined by the appended claims rather than the foregoing description, and all changes that come within the meaning and range of equivalents of the claims are intended to be embraced therein. Any reference to a figure in a claim should not be construed as limiting the claim to which it relates.

[0130] Blockchain, as used in this article, refers to a novel application model for computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms. Blockchain is essentially a decentralized database, a series of data blocks generated using cryptographic methods. Each block contains information about a batch of online transactions, used to verify the validity of this information (to prevent counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, the platform product service layer, and the application service layer.

[0131] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Artificial Intelligence (AI) is the theory, method, technology, and application system that uses digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use knowledge to achieve optimal results.

[0132] Furthermore, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices recited in a system claim may also be implemented by a single unit or device through software or hardware. Terms such as "first" and "second" are used to indicate names and do not imply any particular order.

[0133] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not limiting. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention.

Claims

1. A browser-based image detection method, characterized in that: The method comprises: Changed the synchronous scheduling code of the system layer in the preset image detection model to asynchronous scheduling code; Rewrite the process scheduling code in the preset image detection model into a worker thread; Extracting the image detection core algorithm in the preset image detection model; Combining the asynchronous scheduling code, the worker thread, and the image detection core algorithm into an image detection model target code; Compile the image detection model target code using the Emscripten compiler tool to obtain the target image detection model in the wasm file format; When receiving the image to be detected input by the user through the browser, the wasm file corresponding to the target image detection model is imported through tensorflow, and the target image detection model is instantiated on the browser side; The target image detection model is used to perform image detection on the image to be detected, to obtain an image detection conclusion, and the image detection conclusion is displayed in the browser.

2. The browser-based image detection method according to claim 1, wherein: The Emscripten compiler tool is used to compile the image detection model target code to obtain a target image detection model in a wasm file format, including: Compile the asynchronous scheduling code and the image detection core algorithm in the image detection model target code based on the Emscripten compiler tool to generate intermediate code, and convert the intermediate code into wasm assembly code; Merge the worker thread and wasm assembly code in the target code of the image detection model to generate a wasm file of the target image detection model.

3. The browser-based image detection method according to claim 2, wherein: Instantiating the target image detection model on the browser side includes: Remotely load the wasm file of the target image detection model based on a preset API interface; Load the wasm instance object of the target image detection model based on the wasm file; The target image detection model in the wasm file is called using the wasm instance object.

4. The browser-based image detection method according to claim 1, wherein: The performing image detection on the image to be detected by using the target image detection model to obtain an image detection conclusion includes: Extracting a facial image from the image to be detected; Dividing the facial image into seven target areas; The target image detection model is used to predict the skin quality of each image block to obtain an image detection conclusion.

5. The browser-based image detection method according to claim 1, wherein: The method further comprises: Constructing a training set for the image detection model, labeling the facial images in the training set, and obtaining a true skin quality conclusion for each facial image in the training set; Use convolutional neural networks to build image detection models; Using the image detection model to perform skin quality detection on each facial image in the image detection model training set, to obtain a detection result for each facial image; A preset loss function is used to calculate the loss value between the detection result of the facial image and the true skin quality conclusion of the facial image, and the parameters of the image detection model are adjusted according to the loss value until the loss value is less than a preset loss threshold, thereby obtaining the preset image detection model.

6. A browser-based image detection device, used to implement the browser-based image detection method according to any one of claims 1 to 5, characterized in that: The device comprises: The model compilation module is used to compile the preset image detection model based on the Emscripten compiler to obtain the target image detection model in the wasm file format; The model instantiation module is used to import the wasm file corresponding to the target image detection model through tensorflow when receiving the image to be detected input by the user through the browser, and instantiate the target image detection model on the browser side; The image detection module is used to perform image detection on the image to be detected using the target image detection model, obtain an image detection conclusion, and display the image detection conclusion in the browser.

7. An electronic device, characterized in that: The electronic device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can perform the browser-based image detection method according to any one of claims 1 to 5.

8. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the browser-based image detection method according to any one of claims 1 to 5 is implemented.

Citation Information

Patent Citations

  • Skin type and skin problem identification and detection method based on facial image identification

    CN104299011A

  • Image recognition method and device applied to browser end

    CN112115738A