Visual inspection method, visual inspection apparatus, electronic device, storage medium, and program product
The method improves flexibility in visual inspection by decoupling detection components, allowing updates to one component without affecting others, thus enhancing design, implementation, and testing efficiency.
Patent Information
- Application Number
- PCT/CN2024/116046
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2024-08-30
- Publication Date
- 2026-03-05
AI Technical Summary
Existing visual inspection technologies require updating the entire detection component when a portion of the detection component is updated, reducing flexibility in selecting detection components.
Perform visual inspection using a first detection component to determine the need and a second detection component to invoke the image collection device, allowing updates to one component without affecting others, thereby improving flexibility and enabling quick design, implementation, and testing of detection components.
The method enhances flexibility in selecting detection components by decoupling updates, reducing production line reform time, and optimizing computing power resource allocation.
Smart Images

Figure CN2024116046_05032026_PF_FP_ABST
Abstract
Description
VISUAL INSPECTION METHOD, VISUAL INSPECTION APPARATUS, ELECTRONIC DEVICE, STORAGE MEDIUM, AND PROGRAM PRODUCTTECHNICAL FIELD
[0001] Embodiments of the present disclosure relate to the technical field of image processing, and particularly relates to a visual inspection method, a visual inspection apparatus, an electronic device, a storage medium, and a program product.BACKGROUND
[0002] Artificial Intelligence (AI) means to simulate, extend, and expand human intelligence using a computer or a computer-controlled machine. Artificial intelligence includes study of design principles and implementation methods of various intelligent machines, so that the machines have perception, reasoning and decision-making functions.
[0003] At present, artificial intelligence is widely used in manufacturing industry, and has great potentials in visual inspection of devices. However, in related technologies, visual inspection on a device is generally performed based on a detection component, so that when a portion of the detection component is updated, the entire detection component needs to be updated, thereby reducing the flexibility in selecting the detection component.SUMMARY
[0004] In view of this, the present disclosure provides a visual inspection method, a visual inspection apparatus, an electronic device, a storage medium, and a program product, thereby improving the flexibility in selecting a detection component.
[0005] In a first aspect, the present disclosure provides a visual inspection method applied to an electronic device. The electronic device includes a first detection component, a second detection component, an image collection device, and a to-be-detected object. The method includes: determining, via the first detection component, need for performing visual inspection and a device for performing visual inspection, the device for performing visual inspection including the image collection device and the to-be-detected object; invoking, via a second detection component, the image collection device to perform visual inspection on the to-be-detected object, to obtain an appearance image of the to-be-detected object; and comparing, via the second detection component, the appearance image with a preset appearance image, to obtain a visual inspection result of the to-be-detected object.
[0006] With this method, visual inspection is performed on the to-be-detected object based on the first detection component and the second detection component, so that the update of a single detection component cannot affect other detection components, thereby improving the flexibility in selecting a detection component, and the first detection component and the second detection component can be quickly designed, implemented, and tested, thereby shortening the production line reform time for each detection component.
[0007] In another implementation of the present disclosure, the invoking, via the second detection component, the image collection device to perform visual inspection on the to-be-detected object includes: generating, via the first detection component, an identification code for identifying the image collection device and the to-be-detected object; and acquiring, via the second detection component, the identification code from the first detection component, and invoking the image collection device to perform visual inspection on the to-be-detected object based on the identification code.
[0008] With this method, when the second detection component performs visual inspection on the to-be-detected object based on the identification code to obtain the appearance image of the to-be-detected object, the update of the second detection component cannot affect other detection components, thereby improving the flexibility in selecting the second detection component.
[0009] In another implementation of the present disclosure, the electronic device includes a third detection component; and the acquiring, via the second detection component, the identification code from the first detection component, and invoking the image collection device to perform visual inspection on the to-be-detected object based on the identification code includes: transmitting, via the first detection component, the identification code to the third detection component; and invoking, in response to monitoring, via the second detection component, the identification code from a preset position in the third detection component, the image collection device to perform visual inspection on the to-be-detected object based on the identification code.
[0010] With this method, when the second detection component performs visual inspection on the to-be-detected object based on the monitored identification code to obtain the appearance image of the to-be-detected object, the update of the second detection component cannot affect other detection components, thereby improving the flexibility in selecting the second detection component.
[0011] In another implementation of the present disclosure, the acquiring, via the second detection component, the identification code from the first detection component, and invoking the image collection device to perform visual inspection on the to-be-detected object based on the identification code includes: receiving, via the second detection component, the identification code and an instruction message transmitted from the first detection component, and invoking the image collection device to perform visual inspection on the to-be-detected object based on the identification code and the instruction message; wherein the instruction message is used to instruct that the image collection device needs to perform visual inspection on the to-be-detected object.
[0012] With this method, when the second detection component performs visual inspection on the to-be-detected object based on the received identification code and the instruction message to obtain the appearance image of the to-be-detected object, the update of the second detection component cannot affect other detection components, thereby improving the flexibility in selecting the second detection component.
[0013] In another implementation of the present disclosure, the comparing, via the second detection component, the appearance image with the preset appearance image, to obtain the visual inspection result of the to-be-detected object includes: determining, via the second detection component, a pixel error value at each pixel point between the appearance image and the preset appearance image; and comparing, via the second detection component, the pixel error value at each pixel point with a preset threshold, to obtain a visual inspection result of the to-be-detected object.
[0014] With this method, based on the comparison between the appearance image and the preset appearance image, the visual inspection result of the to-be-detected object can be obtained, thereby subsequently displaying the visual inspection result to a user, so that the user can process the to-be-detected object (for example, eliminating an unqualified to-be-detected object, and for another example, continuing to use a qualified to-be-detected object) .
[0015] In another implementation of the present disclosure, the electronic device further includes a control component; and the determining, via the first detection component, the need for performing visual inspection and the device for performing visual inspection includes: transmitting, via the first detection component, a request message to the control component, wherein the request message is used to request whether visual inspection needs to be performed; receiving, via the first detection component, a response message transmitted from the control component, wherein the response message is used to instruct the need for performing visual inspection and an alternative device for performing visual inspection; and selecting, via the first detection component, the image collection device and the to-be-detected object from the alternative device.
[0016] With this method, the first detection component can determine the need for performing visual inspection and the device for performing visual inspection by message interaction between the first detection component and the control component, thereby ensuring that subsequent visual inspection can be performed, so that the user can process the to-be-detected object based on the visual inspection result (for example, eliminating an unqualified to-be-detected object, and for another example, continuing to use a qualified to-be-detected object) .
[0017] In another implementation of the present disclosure, the method further includes: allocating different computing power resources to the first detection component and the second detection component.
[0018] With this method, different computing power resources are allocated to the first detection component and the second detection component (and the third detection component) , thereby reducing waste of computing power resources.
[0019] In a second aspect, the present disclosure provides a visual inspection apparatus, including: a determination module configured to determine, via a first detection component, need for performing visual inspection and a device for performing visual inspection, the device for performing visual inspection including an image collection device and a to-be-detected object; a detection module configured to invoke, via a second detection component, the image collection device to perform visual inspection on the to-be-detected object, to obtain an appearance image of the to-be-detected object; and a comparison module configured to compare, via the second detection component, the appearance image with a preset appearance image, to obtain a visual inspection result of the to-be-detected object.
[0020] In a third aspect, the present disclosure provides an electronic device, including: a processor, a memory, a communication interface, and a communication bus, wherein the processor, the memory, and the communication interface complete communication with each other through the communication bus; the memory is configured to store one or more executable instructions, and the executable instructions cause the processor to execute the method in the first aspect.
[0021] In a fourth aspect, the present disclosure provides a computer-readable storage medium that stores a computer program, wherein the computer program, when executed by one or more processors, implements the method in the first aspect.
[0022] In a fifth aspect, the present disclosure provides a computer program product, including a computer program instruction, the computer program instruction instructing a computer to execute the method in the first aspect.
[0023] In a sixth aspect, the present disclosure provides a computer program, wherein the computer program, when running on a computer, causes the computer to execute the method in the first aspect.
[0024] In technical solutions provided in the present disclosure, visual inspection is performed on the to-be-detected object based on the first detection component and the second detection component, so that the update of a single detection component cannot affect other detection components, thereby improving the flexibility in selecting a detection component, and the first detection component and the second detection component can be quickly designed, implemented, and tested, thereby shortening the production line reform time for each detection component.DESCRIPTION OF DRAWINGS
[0025] To more clearly describe technical solutions in embodiments of the present disclosure or the prior art, drawings to be used in the description of the embodiments or the prior art will be briefly introduced below. Apparently, the drawings in the description below are merely some embodiments disclosed in the embodiments of the present disclosure. For those of ordinary skills in the art, other drawings may also be obtained based on these drawings.
[0026] FIG. 1 is schematic flowchart I of a visual inspection method provided in an embodiment of the present disclosure;
[0027] FIG. 2 is schematic flowchart II of a visual inspection method provided in an embodiment of the present disclosure;
[0028] FIG. 3 is schematic flowchart III of a visual inspection method provided in an embodiment of the present disclosure;
[0029] FIG. 4 is a schematic block diagram of performing visual inspection provided in an embodiment of the present disclosure;
[0030] FIG. 5 is a schematic structural diagram of a visual inspection apparatus provided in an embodiment of the present disclosure; and
[0031] FIG. 6 is a schematic structural diagram of an electronic device provided in an embodiment of the present disclosure.
[0032] List of reference numerals:
[0033] S110: determining, via a first detection component, need for performing visual inspection and a device for performing visual inspection, the device for performing visual inspection including an image collection device and a to-be-detected object;
[0034] S120: invoking, via a second detection component, the image collection device to perform visual inspection on the to-be-detected object, to obtain an appearance image of the to-be-detected object;
[0035] S130: comparing, via the second detection component, the appearance image with a preset appearance image, to obtain a visual inspection result of the to-be-detected object;
[0036] S210: generating, via a first detection component, an identification code for identifying an image collection device and a to-be-detected object;
[0037] S220: acquiring, via a second detection component, the identification code from the first detection component, and invoking the image collection device to perform visual inspection on the to-be-detected object based on the identification code;
[0038] S301: transmitting, via a Task Service, a request message to a PLC;
[0039] S302: whether the Task Service receives a response message transmitted from the PLC;
[0040] S303: determining, via the Task Service, a camera and a mobile phone based on the response message, and generating an identification code for identifying the camera and the mobile phone;
[0041] S304: transmitting, via the Task Service, the identification code to a MQTT;
[0042] S305: monitoring, via an AI Service, the identification code from a preset position in the MQTT, and invoking the camera to perform visual inspection on the mobile phone based on the identification code, to obtain an appearance image of the mobile phone;
[0043] S306: comparing, via the AI Service, the appearance image with a preset appearance image, to obtain a visual inspection result of the mobile phone;
[0044] S307: transmitting, via the AI Service, the visual inspection result to the MQTT;
[0045] S308: simplifying, via the MQTT, the visual inspection result to obtain a simplified visual inspection result;
[0046] S309: transmitting, via the MQTT, the visual inspection result to the Task Service;
[0047] S310: converting, via the Task Service, the visual inspection result into an output signal, and transmitting the output signal to the PLC;
[0048] S311: displaying, via the PLC, a prompt message based on the output signal, wherein the prompt message is used to prompt a user whether the mobile phone is qualified;
[0049] 401: Configuration service; 402: Programmable logic controller; 403: Task service; 404: Artificial intelligence service; 405: Middleware; 406: Data recording module; 407: Data visualization module; 408: Lighting device; 409: Camera;
[0050] 510: Determination module; 520: Detection module; 530: Comparison module; 540: Generation module; 550: Communication module; 560: Selection module; 570: Configuration module;
[0051] 610: Processor; 620: Communication interface; 630: Memory; 640: Communication bus; 650: Program.DETAILED DESCRIPTION
[0052] To enable those skilled in the art to better understand technical solutions of embodiments of the present disclosure, the technical solutions of the embodiments of the present disclosure will be clearly described in detail below with reference to the drawings in the embodiments of the present disclosure. Apparently, the described embodiments are merely some, instead of all, of the embodiments of the present disclosure. All other embodiments obtained by those of ordinary skills in the art based on some embodiments among the embodiments of the present disclosure should be encompassed within the scope of protection of the embodiments of the present disclosure.
[0053] Unless otherwise defined, all technical terms and scientific terms used herein have the same meanings as commonly understood by those skilled in the technical field of the present disclosure. The terms used herein are only for the purpose of describing the embodiments of the present disclosure, and are not intended to limit the present disclosure.
[0054] In the following description, reference is made to "some embodiments" which describe a subset of all possible embodiments, but it is understandable that "some embodiments" may be a same subset or different subsets of all possible embodiments, and can be combined with each other in the case of no conflict.
[0055] It should be further pointed out that the terms "first\second\third" involved in the embodiments of the present disclosure are only used to distinguish between similar objects, and do not represent particular ordering of objects. It is understandable that particular order or sequence of the "first\second\third" may be interchangeable where permitted, so that the embodiments of the present disclosure described herein can be implemented in an order other than that illustrated or described herein.
[0056] In order to facilitate understanding of the technical solutions of the embodiments of the present disclosure, the related technologies of the embodiments of the present disclosure are described below. As optional solutions, the following related technologies can be combined with the technical solutions of the embodiments of the present disclosure in any way, and are all encompassed within the scope of protection of the embodiments of the present disclosure.
[0057] Artificial Intelligence (AI) means to simulate, extend, and expand human intelligence using a computer or a computer-controlled machine. Artificial intelligence includes study of design principles and implementation methods of various intelligent machines, so that the machines have perception, reasoning and decision-making functions.
[0058] At present, artificial intelligence is widely used in manufacturing industry, and has great potentials in visual inspection of devices. However, in related technologies, visual inspection on a device is generally performed based on a detection component, so that when a portion of the detection component is updated, the entire detection component needs to be updated, thereby reducing the flexibility in selecting the detection component.
[0059] Based on this, an embodiment of the present disclosure provides a visual inspection method, so that visual inspection is performed on a to-be-detected object via a first detection component and a second detection component, and so that the update of a single detection component cannot affect other detection components, thereby improving the flexibility in selecting a detection component.
[0060] In order to facilitate understanding of the technical solutions of the embodiments of the present disclosure, the technical solutions of the present disclosure are described in detail below with reference to specific embodiments. As optional solutions, the above related technologies can be combined with the technical solutions of the embodiments of the present disclosure in any way, and are all encompassed within the scope of protection of the embodiments of the present disclosure. The embodiments of the present disclosure include at least a part of the following contents.
[0061] FIG. 1 is schematic flowchart I of a visual inspection method provided in an embodiment of the present disclosure. The method is applied to an electronic device. The electronic device may include a first detection component, a second detection component, an image collection device, and a to-be-detected object. As shown in FIG. 1, the method may include the following steps:
[0062] S110: determining, via the first detection component, need for performing visual inspection and a device for performing visual inspection, the device for performing visual inspection including the image collection device and the to-be-detected object.
[0063] It should be noted that in an embodiment of the present disclosure, the visual inspection method can be applied to a visual inspection apparatus or an electronic device integrated with the apparatus. The electronic device may be implemented in various forms. For example, the electronic device may include, for example, a smart phone, a tablet computer, a notebook computer, a palm computer, a personal digital assistant (PDA) , or a portable media player (PMP) , which is not limited herein.
[0064] As an example, the first detection component may be a microservice. For example, the first detection component may be a task service.
[0065] It should be noted that the performing visual inspection can be understood as inspecting an appearance of the to-be-detected object using the image collection device, so as to determine whether the appearance of the to-be-detected object is qualified.
[0066] As an example, the image collection device may be, e.g., a camera, a LiDAR, a sensor, or a lighting device that assists the camera in photographing, which is not limited in the embodiments of the present disclosure.
[0067] As an example, the to-be-detected object may be, e.g., a smart phone, a tablet computer, or a notebook computer, which is not limited in the embodiments of the present disclosure.
[0068] For example, when the image collection device is a camera and the to-be-detected object is a mobile phone, back face of the mobile phone can be photographed using a webcam of the camera, thereby determining whether a defect exists on the back face of the mobile phone.
[0069] It should be noted that in the embodiments of the present disclosure, the number of image collection devices includes one or more, and the number of to-be-detected objects includes one or more.
[0070] In some embodiments, the electronic device may further include a control component; and the determining, via the first detection component, the need for performing visual inspection and the device for performing visual inspection may include: transmitting, via the first detection component, a request message to the control component, wherein the request message is used to request whether visual inspection needs to be performed; receiving, via the first detection component, a response message transmitted from the control component, wherein the response message is used to instruct the need for performing visual inspection and an alternative device for performing visual inspection; and selecting, via the first detection component, the image collection device and the to-be-detected object from the alternative device.
[0071] As an example, the control component may be, e.g., a network router, a programmable logic controller (PLC) , a soft PLC (vPLC) , or a next-generation soft PLC, which is not limited in the embodiments of the present disclosure. The soft PLC may be understood as that the PLC itself is a piece of hardware. PLC functions are placed in an industrial personal computer (PC) , so that after connection to the industrial PC, the industrial PC can have soft PLC functions. An industrial PC having soft PLC functions is known as a soft PLC.
[0072] It should be noted that the first detection component can communicate with the control component through control component protocol. As an example, the Task Service can communicate with the PLC through PLC protocol (e.g., a PLC Handler) .
[0073] It should be further noted that after determining the need for performing visual inspection, the control component can indicate an alternative device for performing visual inspection to the first detection component, wherein the alternative device includes one or more image collection devices and one or more to-be-detected objects.
[0074] It should be understood that the alternative device for performing visual inspection can be understood as that, among alternative devices, not all devices need to perform visual inspection, and the first detection component needs to select an image collection device for performing visual inspection and a to-be-detected object from the alternative devices.
[0075] With this method, the first detection component can determine the need for performing visual inspection and the device for performing visual inspection by message interaction between the first detection component and the control component, thereby ensuring that subsequent visual inspection can be performed, so that the user can process the to-be-detected object based on the visual inspection result (for example, eliminating an unqualified to-be-detected object, and for another example, continuing to use a qualified to-be-detected object) .
[0076] S120: invoking, via the second detection component, the image collection device to perform visual inspection on the to-be-detected object, to obtain an appearance image of the to-be-detected object.
[0077] As an example, the second detection component may be a microservice. For example, the second detection component may be an Artificial Intelligence Service (AI Service) .
[0078] It should be noted that the second detection component can communicate with the image collection device via a capture card or gateway.
[0079] S130: comparing, via the second detection component, the appearance image with a preset appearance image, to obtain a visual inspection result of the to-be-detected object.
[0080] In some embodiments, a pixel error value at each pixel point between the appearance image and the preset appearance image can be determined via the second detection component; and the pixel error value at each pixel point can be compared with a preset threshold via the second detection component, to obtain the visual inspection result of the to-be-detected object.
[0081] Further, in some embodiments, the comparing, via the second detection component, the pixel error value at each pixel point with the preset threshold, to obtain the visual inspection result of the to-be-detected object may include:
[0082] determining the appearance of the to-be-detected object to be unqualified, if some pixel error values among pixel error values at each pixel point are greater than or equal to the preset threshold; and
[0083] determining the appearance of the to-be-detected object to be qualified, if the pixel error values at each pixel point are smaller than or equal to the preset threshold.
[0084] In addition, when the appearance of the to-be-detected object is unqualified, positions where the appearance of the to-be-detected object is unqualified can be determined based on positions of some pixel points with pixel error values greater than the preset threshold.
[0085] It should be noted that the preset threshold may be manually set, or may be set in other ways, which is not limited in the embodiments of the present disclosure.
[0086] It should be further noted that the preset appearance image may be a reference image.
[0087] In some embodiments, the determining, via the second detection component, the pixel error value at each pixel point may include: inputting, via the second detection component, the appearance image into an image processing model, and determining, via the image processing model, the pixel error value at each pixel point between the appearance image and the preset appearance image.
[0088] As an example, the image processing model may be a deep learning model.
[0089] With this method, based on the comparison between the appearance image and the preset appearance image, the visual inspection result of the to-be-detected object can be obtained, thereby subsequently displaying the visual inspection result to a user, so that the user can process the to-be-detected object (for example, eliminating an unqualified to-be-detected object, and for another example, continuing to use a qualified to-be-detected object) .
[0090] In some embodiments, the electronic device may further include the control component; and the method may further include: receiving, via the first detection component, the visual inspection result transmitted from the second detection component, converting the visual inspection result into an output signal; receiving, via the control component, the output signal transmitted from the first detection component, and displaying a prompt message based on the output signal, wherein the prompt message is used to prompt the user whether the to-be-detected object is qualified.
[0091] It should be noted that the control component fails to directly identify the visual inspection result, so that the visual inspection result needs to be converted via the first detection component, and so that the control component can identify the converted output signal.
[0092] It should be further noted that if the visual inspection result includes a position where the appearance of the to-be-detected object is unqualified, the prompt message may further prompt the user of the position where the appearance of the to-be-detected object is unqualified.
[0093] Further, the electronic device further includes a third detection component; and the receiving, via the first detection component, the visual inspection result transmitted from the second detection component may include: transmitting, via the second detection component, the visual inspection result to the third detection component; simplifying, via the third detection component, the visual inspection result to obtain a simplified visual inspection result; and receiving, via the first detection component, the simplified visual inspection result transmitted from the third detection component.
[0094] It should be understood that the visual inspection result is simplified, so that the simplified visual inspection result can be more conducive to prompting the user.
[0095] It should be noted that the third detection component may be middleware. For example, the third detection component may be a Message Queuing Telemetry Transport (MQTT) .
[0096] It should be further noted that both the first detection component and the second detection component can communicate with the third detection component through a client. For example, both the first detection component and the second detection component can communicate with the MQTT through a MQTT Client.
[0097] With this method, the user can be prompted through the prompt message whether the to-be-detected object is qualified, so that if the to-be-detected object is unqualified, the user can consider eliminating the unqualified to-be-detected object; and if the to-be-detected object is qualified, the user can consider continuing to use the qualified to-be-detected object.
[0098] In related technologies, visual inspection on a device is generally performed based on a detection component, so that same computing power resources are allocated to the detection component. However, there may be a portion of the detection component that can run with a few computing power resources. In this case, this portion is still allocated with the same computing power resources are as other parts, which will cause waste of computing power resources.
[0099] In some embodiments, the method may further include: allocating different computing power resources to the first detection component and the second detection component.
[0100] Further, the method may further include: allocating different computing power resources to the first detection component, the second detection component, and the third detection component.
[0101] With this method, different computing power resources are allocated to the first detection component and the second detection component (and the third detection component) , thereby reducing waste of computing power resources.
[0102] An embodiment of the present disclosure provides a visual inspection method, including: determining, via a first detection component, need for performing visual inspection and a device for performing visual inspection, the device for performing visual inspection including an image collection device and a to-be-detected object; invoking, via a second detection component, the image collection device to perform visual inspection on the to-be-detected object, to obtain an appearance image of the to-be-detected object; and comparing, via the second detection component, the appearance image with a preset appearance image, to obtain a visual inspection result of the to-be-detected object. In this way, visual inspection is performed on the to-be-detected object via the first detection component and the second detection component, so that the update of a single detection component cannot affect other detection components, thereby improving the flexibility in selecting a detection component.
[0103] It should be understood that in an embodiment of the present disclosure, the first detection component and the second detection component are detection components decoupled from the entire detection component. Respective updates of the first detection component and the second detection component cannot interfere with each other. Further, both the first detection component and the second detection component can be quickly designed, implemented, and tested, and the production line integration process can follow a preset design protocol, thereby reducing the maintenance workload of the service team, and shortening the production line reform time for each detection component.
[0104] In an embodiment of the present disclosure, the image collection device can be invoked via the second detection component to perform visual inspection on the to-be-detected object, to obtain an appearance image of the to-be-detected object. The process of performing visual inspection via the second detection component will be described in detail below with reference to FIG. 2.
[0105] FIG. 2 is schematic flowchart II of a visual inspection method provided in an embodiment of the present disclosure. As shown in FIG. 2, the method may include the following steps.
[0106] S210: generating, via a first detection component, an identification code for identifying an image collection device and a to-be-detected object; and
[0107] S220: acquiring, via a second detection component, the identification code from the first detection component, and invoking the image collection device to perform visual inspection on the to-be-detected object based on the identification code.
[0108] It should be noted that after the first detection component identifies the image collection device and the to-be-detected object using the identification code, other components or devices (e.g., the second detection component) acquire the identification code and can know about a corresponding relationship between the image collection device and the to-be-detected object. That is to say, other components or devices can select the image collection device and the corresponding to-be-detected object.
[0109] It should be understood that several possible implementations below may be available for the acquiring, via the second detection component, the identification code from the first detection component, and invoking the image collection device to perform visual inspection on the to-be-detected object based on the identification code.
[0110] A possible implementation is receiving, via the second detection component, the identification code transmitted from the first detection component, and invoking the image collection device to perform visual inspection on the to-be-detected object based on the identification code.
[0111] It should be noted that in this case, after obtaining the identification code, the second detection component can select the image collection device and the to-be-detected object based on the identification code.
[0112] It should be further noted that in this implementation, after selecting the image collection device and the to-be-detected object based on the identification code, the second detection device itself can know that the image collection device needs to perform visual inspection on the to-be-detected object.
[0113] With this method, when the second detection component performs visual inspection on the to-be-detected object based on the identification code to obtain an appearance image of the to-be-detected object, the update of the second detection component cannot affect other detection components, thereby improving the flexibility in selecting the second detection component.
[0114] In another possible implementation, the electronic device may include a third detection component; the identification code is transmitted to the third detection component via the first detection component; and if the identification code is monitored from a preset position in the third detection component via the second detection component, the image collection device is invoked to perform visual inspection on the to-be-detected object based on the identification code.
[0115] It should be noted that when monitoring the identification code from the preset position in the third detection component, the second detection component can know that the image collection device needs to perform visual inspection of the to-be-detected object; and when monitoring the identification code from other positions in the third detection component or from other detection components, the second detection component cannot know that the image collection device needs to perform visual inspection on the to-be-detected object.
[0116] With this method, when the second detection component performs visual inspection on the to-be-detected object based on the monitored identification code to obtain the appearance image of the to-be-detected object, the update of the second detection component cannot affect other detection components, thereby improving the flexibility in selecting the second detection component.
[0117] In another possible implementation, the identification code and an instruction message transmitted from the first detection component are received via the second detection component, and the image collection device is invoked to perform visual inspection on the to-be-detected object based on the identification code and the instruction message; wherein the instruction message is used to instruct that the image collection device needs to perform visual inspection on the to-be-detected object.
[0118] With this method, when the second detection component performs visual inspection on the to-be-detected object based on the received identification code and the instruction message to obtain the appearance image of the to-be-detected object, the update of the second detection component cannot affect other detection components, thereby improving the flexibility in selecting the second detection component.
[0119] An embodiment of the present disclosure provides a visual inspection method. A second detection device can invoke the image collection device to perform visual inspection on the to-be-detected object based on the identification code, thereby obtaining the appearance image of the to-be-detected object. The update of the second detection component cannot affect other detection components, thereby improving the flexibility in selecting the second detection component.
[0120] Steps included in the visual inspection method are illustrated above with reference to FIGS. 1 and 2. In the following embodiments, as an example, the first detection component is a Task Service, the second detection component is an AI Service, the third detection component is a MQTT, the control component is a PLC, the image collection device as a camera, and the to-be-detected object is a mobile phone. The entire process of performing visual inspection is set forth in detail with reference to FIGS. 3 and 4.
[0121] FIG. 3 is schematic flowchart III of a visual inspection method provided in an embodiment of the present disclosure. As shown in FIG. 3, the method may include the following steps.
[0122] S301: transmitting, via a Task Service, a request message to a PLC.
[0123] The request message may be used to request whether visual inspection needs to be performed.
[0124] S302: whether the Task Service receives a response message transmitted from the PLC.
[0125] The response message may be used to instruct need for performing visual inspection and an alternative device for performing visual inspection.
[0126] If receiving the response message, the Task Service executes S303-S311; and if not receiving the response message, the Task Service continues to execute S301 and S302.
[0127] S303: determining, via the Task Service, a camera and a mobile phone based on the response message, and generating an identification code for identifying the camera and the mobile phone.
[0128] It should be noted that the Task Service can select the camera and the mobile phone from the alternative device.
[0129] S304: transmitting, via the Task Service, the identification code to a MQTT.
[0130] S305: monitoring, via an AI Service, the identification code from a preset position in the MQTT, and invoking the camera to perform visual inspection on the mobile phone based on the identification code, to obtain an appearance image of the mobile phone.
[0131] It should be noted that when monitoring the identification code from the preset position in the MQTT, the AI Service can know that the camera needs to perform visual inspection on the mobile phone; and when monitoring the identification code from other positions in the MQTT or from other detection components, the AI Service cannot know that the camera needs to perform visual inspection on the mobile phone.
[0132] It should be understood that the preset position in the MQTT may be a subject in the MQTT, or may be a port used by the MQTT, or may be other positions, which is not limited in the embodiments of the present disclosure.
[0133] As an example, the preset position in the MQTT may be a subject (e.g., a character string) in the MQTT, wherein the subject is used to indicate that the camera needs to perform visual inspection on the mobile phone. For example, assuming that a subject in the MQTT is: camera / mobile phone / perform visual inspection, and when monitoring the identification code under this subject, the AI Service can know that the camera needs to perform visual inspection on the mobile phone.
[0134] As an example, the preset position in the MQTT may be a port used by the MQTT. When monitoring the identification code from this port, the AI Service can know that the camera needs to perform visual inspection on the mobile phone.
[0135] It should be noted that, in addition to the method shown in S304 and S305, the Task Service can further transmit the identification code and the instruction message to the AI Service, wherein the instruction message is used to instruct that the camera needs to perform visual inspection on the mobile phone; and the AI Service can invoke the camera to perform visual inspection on the mobile phone based on the identification code and the instruction message, to obtain the appearance image of the mobile phone.
[0136] S306: comparing, via the AI Service, the appearance image with a preset appearance image, to obtain a visual inspection result of the mobile phone.
[0137] It should be noted that the AI Service can determine a pixel error value at each pixel point between the appearance image and the preset appearance image; and compare the pixel error value at each pixel point with a preset threshold, to obtain the visual inspection result of the mobile phone.
[0138] It should be further noted that the AI Service can store the visual inspection result in a database to facilitate subsequent queries.
[0139] Further, the AI Service can display the visual inspection result through a Graphical User Interface (GUI) .
[0140] S307: transmitting, via the AI Service, the visual inspection result to the MQTT.
[0141] S308: simplifying, via the MQTT, the visual inspection result to obtain a simplified visual inspection result.
[0142] It should be understood that the visual inspection result is simplified, so that the simplified visual inspection result can be more conducive to prompting the user.
[0143] S309: transmitting, via the MQTT, the visual inspection result to the Task Service.
[0144] It is understandable that the AI Service can also directly transmit the visual inspection result to the Task Service.
[0145] S310: converting, via the Task Service, the visual inspection result into an output signal, and transmitting the output signal to the PLC.
[0146] It should be noted that the PLC fails to directly identify the visual inspection result, so that the visual inspection result needs to be converted via the Task Service, and so that the PLC can identify the converted output signal.
[0147] S311: displaying, via the PLC, a prompt message based on the output signal, wherein the prompt message is used to prompt the user whether the mobile phone is qualified.
[0148] It should be noted that if the visual inspection result includes a position where an appearance of the mobile phone is unqualified, the prompt message may further prompt the user of the position where the appearance of the mobile phone is unqualified.
[0149] An embodiment of the present disclosure provides a visual inspection method, based on which, visual inspection is performed on the mobile phone via the Task Service and the AI Service, so that the update of a single detection component cannot affect other detection components, thereby improving the flexibility in selecting a detection component.
[0150] FIG. 4 is a schematic block diagram of performing visual inspection provided in an embodiment of the present disclosure. As shown in FIG. 4, modules for performing visual inspection may include a Configuration Service 401, a programmable logic controller 402, a task service 403, an artificial intelligence service 404, middleware 405, a data recording module 406, a data visualization module 407, a lighting device 408, and a camera 409. The process of performing visual inspection via the modules may include:
[0151] the configuration service 401 is configured to configure the task service 403 and the artificial intelligence service 404. For example, the configuration service 401 can configure a connection port of the programmable logic controller 402 for the task service 403, so that the task service 403 can be connected to the programmable logic controller 402 through the connection port. For another example, the configuration service 401 can configure an invokable device (e.g., the camera 409) for the artificial intelligence service 404.
[0152] The programmable logic controller 402 can communicate with the task service 403 through a PLC protocol (e.g., a PLC Handler) . The task service 403 can transmit a request message to the programmable logic controller 402, and the task service 403 can receive the response message transmitted from the programmable logic controller 402. The request message may be used to request whether visual inspection needs to be performed, and the response message may be used to indicate the need for performing visual inspection and an alternative device for performing visual inspection.
[0153] Based on the response message, the task service 403 can determine the mobile phone (not shown in the figure) , the camera 409, and the lighting device 408 that assists the camera 409 in photographing, and generate an identification code for identifying the camera 409 and the mobile phone. The task service 403 can transmit the identification code to the middleware 405. The task service 403 may include a log, by which cause of a problem in the task service 403 may be prompted.
[0154] The artificial intelligence service 404 can monitor the identification code from a preset position in the middleware 405, and can invoke the camera 409 (and the lighting device 408) to perform visual inspection on the mobile phone based on the identification code, to obtain an appearance image of the mobile phone. The artificial intelligence service 404 compares the appearance image with a preset appearance image to obtain a visual inspection result of the mobile phone. The artificial intelligence service 404 transmits the visual inspection result to the middleware 405.
[0155] The middleware 405 simplifies the visual inspection result to obtain a simplified visual inspection result. The middleware 405 transmits the visual inspection result to the task service 403. The task service 403 converts the visual inspection result into an output signal, and transmits the output signal to the programmable logic controller 402.
[0156] The programmable logic controller 402 can display a prompt message based on the output signal, wherein the prompt message is used to prompt a user whether the mobile phone is qualified. The programmable logic controller 402 can be connected to an actuator (e.g., a gripper or a motor) to display the prompt message by controlling the actuator.
[0157] The data recording module 406 can be configured to record data involved in a process of performing visual inspection, and communicate with the data visualization module 407 via a connector, so that the data can be displayed via the data visualization module 407, thereby determining the time with many defects of the mobile phone based on the data.
[0158] It should be noted that the artificial intelligence service 404 can store the visual inspection result in a database to facilitate subsequent queries. The artificial intelligence service 404 may also display the visual inspection result via a GUI. The artificial intelligence service 404 may include a log, by which cause of a problem in the artificial intelligence service 404 may be prompted. The artificial intelligence service 404 can invoke the camera 409 based on camera control, and can invoke the lighting device 408 based on light source control.
[0159] It should be further noted that both the task service 403 and the artificial intelligence service 404 can communicate with the middleware 405 through a client.
[0160] It should be further noted that the task service 403, the artificial intelligence service 404, the middleware 405, the data recording module 406, and the data visualization module 407 can be hosted on an industrial PC. The artificial intelligence service 404 can perform visual inspection on the mobile phone using a graphic processing unit (GPU) and a neural processing unit (NPU) .
[0161] It should be further noted that the programmable logic controller 402 may be located in an automatic system, and the task service 403, the artificial intelligence service 404, the middleware 405, the data recording module 406, and the data visualization module 407 may be located in an artificial intelligence detection system.
[0162] An embodiment of the present disclosure provides a visual inspection method, based on which the artificial intelligence detection system is decoupled, so that integration of the artificial intelligence detection system and the automatic system is an implementation for decoupling, which is beneficial to quick integration between the two systems, and facilitates system maintenance. Visual inspection is performed on the mobile phone using the decoupled task service, artificial intelligence service, middleware, data recording module, and data visualization module, so that the update of a single detection component cannot affect other detection components, thereby improving the flexibility in selecting a detection component.
[0163] The preferred embodiments of the present disclosure are described in detail above with reference to the drawings. However, the present disclosure is not limited to the specific details of the above-mentioned embodiments. Within the scope of the technical concept of the present disclosure, multiple simple modifications can be made to the technical solutions of the present disclosure, and the simple modifications are all encompassed within the scope of protection of the present disclosure. For example, specific technical features described in the above-mentioned specific embodiments can be combined in any suitable way in the case of no conflict. In order to avoid unnecessary repetitions, various possible combinations will not be separately described in the present disclosure. For another example, any combination of various embodiments of the present disclosure may be performed, as long as the combination does not violate the concept of the present disclosure. The combination should also be regarded as the content disclosed in the present disclosure. For another example, embodiments in the present disclosure and / or technical features in the embodiments and the prior art may be combined with each other in any way in the case of no conflict, and the combined technical solutions should also be encompassed within the scope of protection of the present disclosure.
[0164] It should be further understood that in the method embodiments of the present disclosure, the magnitudes of the sequence numbers of the above-mentioned processes do not mean the execution sequence. The execution sequence of the processes should be determined based on functions and internal logics thereof, and should not impose any limitation on the implementation processes of the embodiments of the present disclosure.
[0165] Based on the same inventive concept of the foregoing embodiments, FIG. 5 is a schematic structural diagram of a visual inspection apparatus provided in an embodiment of the present disclosure. As shown in FIG. 5, the visual inspection apparatus may include:
[0166] a determination module 510 configured to determine, via a first detection component, need for performing visual inspection and a device for performing visual inspection, the device for performing visual inspection including an image collection device and a to-be-detected object;
[0167] a detection module 520 configured to invoke, via a second detection component, the image collection device to perform visual inspection on the to-be-detected object, to obtain an appearance image of the to-be-detected object; and
[0168] a comparison module 530 configured to compare, via the second detection component, the appearance image with a preset appearance image, to obtain a visual inspection result of the to-be-detected object.
[0169] In some embodiments, the visual inspection apparatus may further include a generation module 540; wherein:
[0170] the generation module 540 is configured to generate, via the first detection component, an identification code for identifying the image collection device and the to-be-detected object; and
[0171] the detection module 520 is further configured to acquire, via the second detection component, the identification code from the first detection component, and invoke the image collection device to perform visual inspection on the to-be-detected object based on the identification code.
[0172] In some embodiments, the visual inspection apparatus may further include a communication module 550; wherein:
[0173] the communication module 550 is configured to transmit, via the first detection component, the identification code to a third detection component; and
[0174] the detection module 520 is further configured to invoke, in response to monitoring, via the second detection component, the identification code from a preset position in the third detection component, the image collection device to perform visual inspection on the to-be-detected object based on the identification code.
[0175] In some embodiments, the communication module 550 is further configured to receive, via the second detection component, the identification code and an instruction message transmitted from the first detection component; and the detection module 520 is further configured to invoke the image collection device to perform visual inspection on the to-be-detected object based on the identification code and the instruction message; wherein the instruction message is used to instruct that the image collection device needs to perform visual inspection on the to-be-detected object.
[0176] In some embodiments, the determination module 510 is further configured to determine, via the second detection component, a pixel error value at each pixel point between the appearance image and the preset appearance image; and the comparison module 530 is further configured to compare, via the second detection component, the pixel error value at each pixel point with a preset threshold, to obtain the visual inspection result of the to-be-detected object.
[0177] In some embodiments, the visual inspection apparatus may further include a selection module 560; wherein:
[0178] the communication module 550 is further configured to transmit, via the first detection component, a request message to a control component, wherein the request message is used to request whether visual inspection needs to be performed; and receive, via the first detection component, a response message transmitted from the control component, wherein the response message is used to instruct the need for performing visual inspection, and an alternative device for performing visual inspection; and
[0179] the selection module 560 is configured to select, via the first detection component, the image collection device and the to-be-detected object from the alternative device.
[0180] In some embodiments, the visual inspection apparatus may further include a configuration module 570; wherein:
[0181] the configuration module 570 is configured to allocate different computing power resources to the first detection component and the second detection component.
[0182] In technical solutions provided in the embodiments of the present disclosure, visual inspection is performed on the to-be-detected object via the first detection component and the second detection component, so that the update of a single detection component cannot affect other detection components, thereby improving the flexibility in selecting a detection component, and the first detection component and the second detection component can be quickly designed, implemented, and tested, thereby shortening the production line reform time for each detection component.
[0183] Those skilled in the art should understand that the relevant description of the above visual inspection apparatus in the embodiments of the present disclosure can be understood with reference to the relevant description of the visual inspection method in the embodiments of the present disclosure.
[0184] FIG. 6 is a schematic structural diagram of an electronic device provided in an embodiment of the present disclosure. The electronic device may include: a processor 610, a communications interface 620, a memory 630 storing a program 650, and a communication bus 640.
[0185] The processor 610, the communication interface 620, and the memory 630 complete communication with each other through the communication bus 640.
[0186] The communication interface 620 is configured to communicate with other electronic devices or servers.
[0187] The processor 610 is configured to perform the program 650, and specifically may perform relevant steps in the above method embodiments.
[0188] Specifically, the program 650 may include a code of the program 650. The code of the program 650 includes one or more executable computer operation instructions.
[0189] The processor 610 may be a central processing unit (CPU) , or an Application Specific Integrated Circuit (ASIC) , or one or more integrated circuits configured to implement the embodiments of the present disclosure. One or more processors included in a smart device may be processors of a same type, e.g., one or more CPUs; or may be processors of different types, e.g., one or more CPUs and one or more ASICs.
[0190] The memory 630 is configured to store one or more executable instructions. The memory 630 may include a high-speed random access memory (RAM) , and may also further include a non-volatile memory, such as one or more disk memories.
[0191] One or more executable instructions may be specifically used to cause the processor 610 to execute the method provided in the embodiments of the present disclosure.
[0192] In addition, corresponding descriptions of the corresponding steps and units in the above method embodiments may be referred to for specific implementations of the steps in the one or more executable instructions, which will not be repeated here. Those skilled in the art can clearly understand that, for convenience and simplicity of description, the description of corresponding processes in the above-mentioned method embodiments may be referred to for specific working processes of the above-described devices and modules, which will not be repeated here.
[0193] An embodiment of the present disclosure further provides a computer-readable storage medium configured to store a computer program.
[0194] In some embodiments, the computer-readable storage medium can be applied to the electronic device in the embodiments of the present disclosure, and the computer program, when executed by one or more processors, implements corresponding processes implemented by the electronic device in the methods of the embodiments of the present disclosure, which will not be repeated here for the sake of brevity.
[0195] An embodiment of the present disclosure further provides a computer program product, including a computer program instruction.
[0196] In some embodiments, the computer program product can be applied to the electronic device in the embodiments of the present disclosure, and the computer program instruction causes a computer to perform corresponding processes implemented by the electronic device in the methods of the embodiments of the present disclosure, which will not be repeated here for the sake of brevity.
[0197] An embodiment of the present disclosure further provides a computer program.
[0198] In some embodiments, the computer program can be applied to the electronic device in the embodiments of the present disclosure. The computer program, when running on a computer, causes the computer to perform corresponding processes implemented by the electronic device in the methods of the embodiments of the present disclosure, which will not be repeated here for the sake of brevity.
[0199] As will be appreciated by those of ordinary skills in the art, the example units and method steps described in combination with the embodiments disclosed in the present disclosure can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are executed by hardware or software depends on particular applications and design constraints of the technical solutions. Those skilled in the art may implement the described functions for each particular application using different methods, but such implementation should not be considered as falling beyond the scope of the embodiments of the present disclosure.
[0200] It should be further noted that in the present disclosure, the terms such as "comprising, " "including" or any other variation thereof are intended to encompass non-exclusive inclusions, such that a process, a method, an article, or an apparatus that includes a series of elements not only includes those elements, but also includes other elements that are not explicitly listed, or further includes elements that are inherent to such a process, method, article, or apparatus. In the case of no more constraints, an element defined by the wording "comprise a ... " does not preclude the existence of additional identical elements in a process, a method, an article, or an apparatus that includes the element.
[0201] The serial numbers in the above embodiments of the present disclosure are only for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
[0202] The methods disclosed in several method embodiments provided in the present disclosure can be combined in any way in the case of no conflict, to obtain new method embodiments.
[0203] The features disclosed in several product embodiments provided in the present disclosure can be combined in any way in the case of no conflict, to obtain new product embodiments.
[0204] The features disclosed in several method or device embodiments provided in the present disclosure can be combined in any way in the case of no conflict, to obtain new method embodiments or device embodiments.
[0205] The above embodiments are only used to illustrate the embodiments of the present disclosure, and are not intended to limit the embodiments of the present disclosure. Those of ordinary skills in the relevant technical field may further make various alterations and modifications without departing from the spirit and scope of the embodiments of the present disclosure. Therefore, all equivalent technical schemes are also encompassed within the scope of the embodiments of the present disclosure, and the scope of patent protection of the embodiments of the present disclosure should be defined by the appended claims.
Claims
1.A visual inspection method, applied to an electronic device, the electronic device comprising a first detection component, a second detection component, an image collection device, and a to-be-detected object, the method comprising:determining, via the first detection component, need for performing a visual inspection and a device for performing the visual inspection, the device for performing the visual inspection comprising the image collection device and the to-be-detected object (S110) ;invoking, via the second detection component, the image collection device to perform the visual inspection on the to-be-detected object, to obtain an appearance image of the to-be-detected object (S120) ; andcomparing, via the second detection component, the appearance image with a preset appearance image, to obtain a visual inspection result of the to-be-detected object (S130) .2.The method according to claim 1, wherein the invoking, via the second detection component, the image collection device to perform the visual inspection on the to-be-detected object comprises:generating, via the first detection component, an identification code for identifying the image collection device and the to-be-detected object (S210) ; andacquiring, via the second detection component, the identification code from the first detection component, and invoking the image collection device to perform the visual inspection on the to-be-detected object based on the identification code (S220) .3.The method according to claim 2, wherein the electronic device comprises a third detection component; and the acquiring, via the second detection component, the identification code from the first detection component, and invoking the image collection device to perform the visual inspection on the to-be-detected object based on the identification code comprises:transmitting, via the first detection component, the identification code to the third detection component; andinvoking, in response to monitoring, via the second detection component, the identification code from a preset position in the third detection component, the image collection device to perform the visual inspection on the to-be-detected object based on the identification code.4.The method according to claim 2, wherein the acquiring, via the second detection component, the identification code from the first detection component, and invoking the image collection device to perform the visual inspection on the to-be-detected object based on the identification code comprises:receiving, via the second detection component, the identification code and an instruction message transmitted from the first detection component, and invoking the image collection device to perform the visual inspection on the to-be-detected object based on the identification code and the instruction message; wherein the instruction message is used to instruct that the image collection device needs to perform the visual inspection on the to-be-detected object.5.The method according to any one of claims 1-4, wherein the comparing, via the second detection component, the appearance image with the preset appearance image, to obtain the visual inspection result of the to-be-detected object comprises:determining, via the second detection component, a pixel error value at each pixel point between the appearance image and the preset appearance image; andcomparing, via the second detection component, the pixel error value at each pixel point with a preset threshold, to obtain a visual inspection result of the to-be-detected object.6.The method according to any one of claims 1-5, wherein the electronic device further comprises a control component; and the determining, via the first detection component, the need for performing the visual inspection and the device for performing the visual inspection comprises:transmitting, via the first detection component, a request message to the control component, wherein the request message is used to request whether the visual inspection needs to be performed;receiving, via the first detection component, a response message transmitted from the control component, wherein the response message is used to instruct the need for performing the visual inspection and an alternative device for performing the visual inspection; andselecting, via the first detection component, the image collection device and the to-be-detected object from the alternative device.7.The method according to any one of claims 1-6, wherein the method further comprises:allocating different computing power resources to the first detection component and the second detection component.8.A visual inspection apparatus, comprising:a determination module (510) configured to determine, via a first detection component, need for performing a visual inspection and a device for performing the visual inspection, the device for performing the visual inspection comprising an image collection device and a to-be-detected object;a detection module (520) configured to invoke, via a second detection component, the image collection device to perform the visual inspection on the to-be-detected object, to obtain an appearance image of the to-be-detected object; anda comparison module (530) configured to compare, via the second detection component, the appearance image with a preset appearance image, to obtain a visual inspection result of the to-be-detected object.9.An electronic device, comprising: a processor, a memory, a communication interface, and a communication bus, wherein the processor, the memory, and the communication interface complete communication with each other through the communication bus; the memory is configured to store one or more executable instructions, and the executable instructions cause the processor to execute the method according to any one of claims 1-7.10.A computer-readable storage medium, storing a computer program, wherein the computer program, when executed by one or more processors, implements the method according to any one of claims 1-7.11.A computer program product, comprising a computer program instruction, the computer program instruction instructing a computer to execute the method according to any one of claims 1-7.
Citation Information
Patent Citations
Automatic visual inspection equipment for motor commutator
CN111879780A
Visual inspection method for defects of transparent packaging IC
CN112396599A
Guitar finished product detection method and detection system based on machine vision
CN113570572A
Visual inspection apparatus of round rod body
JP2004101339A
Method and apparatus for detecting a workpiece, and method and apparatus for inspecting a workpiece
US20050058333A1