Method for improving accuracy of machine learning models

EP4802437A1Pending Publication Date: 2026-09-09SAMSUNG ELECTRONICS CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
EP2025809644
Authority / Receiving Office
EP · EP
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-05-17
Filing Date
2025-04-03
Publication Date
2026-09-09

AI Technical Summary

Technical Problem

Current techniques for training neuro-symbolic machine learning models lack guarantees on the accuracy and effectiveness of the training process, particularly in integrating high-level reasoning with low-level perception, leading to inconsistent and unreliable performance in tasks requiring precise object detection and relationship understanding.

Method used

The method employs partial label learning to train neuro-symbolic models by using logical reasoning to generate a new training dataset with multiple possible labels and relationships, which are then used to update the model weights, ensuring better control over the training process and improving accuracy.

Benefits of technology

This approach provides statistical guarantees on the accuracy of neuro-symbolic models by reducing the training problem to partial label learning, enhancing the model's ability to detect objects and relationships accurately, especially in scenarios involving autonomous devices and human interaction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure IB2025053512_13112025_PF_FP_ABST
    Figure IB2025053512_13112025_PF_FP_ABST
Patent Text Reader

Abstract

Broadly speaking, embodiments of the present techniques provide a method for training neuro-symbolic ML models through partial label learning, to improve the accuracy of the predictions of the ML models. Advantageously, the present techniques provide a training method which improves how well the ML model is trained, by reducing the training problem to that of partial label learning. In other words, the present techniques train the neural module through partial label learning, rather than conventional multi-class learning techniques.
Need to check novelty before this filing date? Find Prior Art

Description

Description TITLE OF INVENTION: METHOD FOR IMPROVING ACCURACY OF MACHINE LEARNING MODELS Technical Field

[0001] The present application generally relates to a method and apparatus for improving the accuracy of machine learning, ML, models. In particular, the present application provides a method for training neuro-symbolic ML models through partial label learning that provides guarantees on the success of the training process for a neural module of the neuro-symbolic framework. Background Art

[0002] A growing focus in the advancement of machine learning models is the integration of high-level reasoning with low-level perception. So-called neuro- symbolic frameworks aim to achieve this integration. The potential benefits of neuro- symbolic frameworks are that they require fewer training data, result in smaller models, and have higher accuracy. Typically, neuro-symbolic frameworks comprise several modules in a sequence. The frameworks are said to be stratified. An exemplary stratified framework could comprise a neural module that houses a neural network, a translator module that maps the outputs of the neural module such that they are in an appropriate form to serve as input to a symbolic module.

[0003] Current techniques for training neuro-symbolic frameworks do not provide a guarantee on how well the neural module is trained.

[0004] The applicant has therefore identified the need for an improved method for training neuro-symbolic ML models with improved accuracy. Summary of Invention

[0005] This disclosure relates to a method and apparatus for improving the accuracy of machine learning, ML, models. Solution to Problem

[0006] In a first approach of the present techniques, there is provided a computer- implemented method for training a machine learning, ML, model to perform an imageprocessing task, the method comprising: obtaining a training dataset comprising a plurality of images, each image depicting at least two objects; for each image of the plurality of images: inputting the image into a neural module of the ML model, wherein the neural module is trained to output a bounding box around each object in an image; outputting, from the neural module, a bounding box around the at least two objects in the input image and features of the object in each bounding box; inputting the output from the neural module into a symbolic module of the ML model, wherein the symbolic module is trained to: output a plurality of possible labels based on the features of the object in each bounding box, and output a plurality of possible relationships between objects in each pair of bounding boxes; outputting, from the symbolic module, a plurality of possible labels derived for each bounding box in the image, and a plurality of possible relationships between objects in each pair of bounding boxes; generating a new partially-labelled training dataset comprising the training dataset and the bounding boxes output from the neural model and the possible labels and possible relationships output by the symbolic module for each image of the training dataset; and training the ML model by: calculating a loss by comparing the plurality of possible labels and the plurality of possible relationships derived for each image with a ground truth label for the image; and updating weights of one or both of the neural module and the symbolic module based on the calculated loss.

[0007] Typically, when neuro-symbolic ML models are trained, there are no guarantees on how well the ML models have been trained. Advantageously, the present techniques provide a training method which improves how well the ML model is trained, by reducing the training problem to that of partial label learning. In other words, the present techniques train the neural module through partial label learning, rather than conventional multi-class learning techniques.

[0008] Consider the following problem. It is desirable to understand an image depicting at least two objects. For example, an image may be of the inside of a room in a house, and may depict a spoon inside a bowl, and the bowl on a table. A neuro- symbolic ML model may be trained to detect and label the three objects: spoon, bowl, table. The neuro-symbolic ML model may also be trained to generate relationships between the at least two objects, such as “the spoon is on the table”, “the spoon is insidethe bowl”, etc. This may enable visual understanding of the scene depicted in the image. Similarly, an image may be of a tennis match, and may depict two players, where one of the players is shown hitting the tennis ball. The neuro-symbolic ML model may be trained to detect and label the objects: tennis ball, tennis racket 1, tennis racket 2, net, player 1, player 2, tennis court, etc. The model may also generate relationships between the objects, such as “player 1 and player 2 are playing a game of tennis”, “player 1 is holding a tennis racket”, “tennis racket 1 is in contact with a tennis ball”, etc. However, in both examples, it is desirable to check the accuracy of the labels and the relationships generated by the ML model. This is particularly important in cases where the neuro- symbolic ML model is to be used to control an electronic device, such as an autonomous vehicle or robotic device. It is also advantageous in cases where the ML model is to be used by humans (such as gallery search, question answering, augmented reality, etc) to enhance the user experience.

[0009] The present techniques reduce the problem of determining how well a neuro-symbolic ML model has been trained to one of partial label learning, which is a well-understood problem and technique.

[0010] Partial label learning is a technique for training a ML model, such as one comprising an image classifier, using data that is partially labelled. For example, an image depicting two people playing tennis may be labelled as “person A and person B playing tennis”. This is a partial label because you do not which person in the image is person A and which person in the image is person B. For a static image, this may not matter, but if the image is one of a series of frames from a video depicting the tennis match, it is going to be helpful to know which person is which so that each person’s activity can be tracked across the frames. Similarly, the image mentioned above of the inside of a house may be labelled with “a spoon and bowl on a table”, but it may not be clear which object is the spoon and which is the bowl, or that the spoon is in the bowl. A robotic home assistant device may need to know which object is which because it may be tasked with finding and retrieving the bowl.

[0011] Thus, in order to train a neuro-symbolic ML model, the present techniques first use the neural module and symbolic module of the ML model in the normal way, to identify objects in an image, predict a plurality of possible labels for them, and predicta plurality of possible relationships between them. For example, in the tennis example, the image may depict two people playing tennis, as well as an umpire (who watches the game and enforces the rules), and a ball girl or ball boy (who retrieve and supply balls for the players). The label for the image – “person A and person B playing tennis” – does not make it clear which of the four people depicted are playing tennis. Thus, for each person, there may be four possible labels: player 1, player 2, umpire, ball girl / boy. For each person, there is a relationship with other objects and people in the image. Only one of the labels and relationships for each object is correct out of the set of possible labels and possible relationships, as required by partial label learning. These possible labels and relationships are then used to generate a new version of the original training dataset, and used to retrain the neuro-symbolic ML model.

[0012] Thus, partial labels for each input image are generated using techniques from logic (i.e. logical reasoning) in order to implement the partial label learning. Rather than taking the conventional form of training dataset where information on the ground-truth class is provided, the training data for the neuro-symbolic ML model comprises information on a target output of a logical theory of the symbolic module. This particular form of the training dataset means that training neural modules is less well-controlled than for conventional training techniques. By adopting techniques from logic and adapting the architecture of the neural module, the present techniques provide guarantees on the learnability of the neural module.

[0013] Outputting, from the symbolic module, a plurality of possible labels may comprise: generating, using a set of logical rules specifying constraints specific to the training dataset and the features of the object in each bounding box, the plurality of possible labels for the object in each bounding box. For example, if the aim of the machine learning model is to perform the addition of two integers to obtain a known target total, where the two integers are obtained in the form of two images of single digits, then the set of logical rules may comprise combinations of integers whose sum would equal the target total. The rules constrain the predictions made by the symbolic module. Similarly, in the tennis example, the aim of the ML model may be to understand who in the image is playing tennis. The rules in this case may include the rules of tennis, such as that there are two players, the game involves rackets and a ball,and each player stands on either side of a net. This may help to narrow down which of the four people are playing tennis, and which people are umpiring or retrieving balls.

[0014] Outputting, from the symbolic module, plurality of possible relationships comprises, for each pair of bounding boxes in an image, may comprise: generating, using a set of logical rules specifying constraints specific to the training dataset and the plurality of possible labels for the object in each bounding box of the pair of bounding boxes, the plurality of possible relationships between the objects in the pair of bounding boxes. As noted above, the rules help to constrain the possible outputs of the symbolic module. In this case, the rules may help to determine the relationships between objects. For example, “player 1 is holding a racket”, “the ball girl is standing by the net”, and “player 1 is playing a tennis match against player 2”.

[0015] In some cases, the image being processed may be a single image or frame of a video. In this case, the generating may comprise using a set of logical rules defining likely relationships for objects within a single image or frame. That is, the logical rules may define local rules for single images / frames. For example, if an image shows one person walking across a road, then there is a good chance other people in the image may also be walking across the road. One rule may be therefore that if two objects are close to each other in the same image / frame, then they are likely to be performing the same action. Similarly, if there are many people in the same image (e.g. image of a start line for a marathon or image of people inside a supermarket), then they may all be doing the same thing.

[0016] In some cases, the image being processed may not be a single image / frame, but may comprise a plurality of adjacent frames of a video. In this case, above-mentioned rules may apply to each individual frame, but the generating may also comprise using a set of logical rules defining likely relationships for objects appearing in adjacent frames. That is, the logical rules may define global rules that apply across adjacent frames. For example, if a bounding box is placed around an object in substantially the same position in adjacent frames, then it is highly likely that each bounding box shows the same object.

[0017] The logical rules may be or comprise general logical rules. For example, the logical rules may include arithmetic or other mathematical operations, or be based on laws of physics, which must hold true in all scenarios.

[0018] The logical rules may be or comprise rules that are constructed by a human user or operator and be based on real-life scenarios. For example, for images depicting a group of people crossing a road, the fact that one actor in the image has been classified as walking, and that another actor has been identified in close proximity to the walking actor, may be used to infer that the identified actor is also walking. In other words, a logical rule may be constructed to stipulate that actors in close proximity to other actors performing an action are necessarily also performing the same action.

[0019] In some cases, the image processing task may comprise scene graph generation, and the method may comprise outputting, from the ML model, a scene graph. A scene graph is a data structure which arranges and represents logical connections objects in a scene. For example, if the input image shows a spoon inside a bowl on a table, the scene graph generated using the outputs of the neural and symbolic modules may be a graph with a node corresponding to the spoon, a node corresponding to the bowl, a node corresponding to the table, and a directed edge between these the spoon and bowl nodes indicating the relationship between the spoon and the bowl, and a directed edge between the bowl and table nodes indicating the relationship between the bowl and table. The graph may indicate that the spoon is inside the bowl (correct relationship), or that the bowl is inside the spoon (incorrect relationship).

[0020] In some cases, the image processing task may comprise action recognition. In this case, outputting, from the neural module, a bounding box around the at least two objects may comprise outputting a bounding box around the at least two actors within the image; and outputting, from the symbolic module, a plurality of possible labels and a plurality of possible relationships may comprise outputting a plurality of possible actions performed by each actor, and a plurality of possible relationships between the actors in each pair of bounding boxes.

[0021] In one example of the present techniques, training of the neuro-symbolic model involves using visual question answering. Visual question answering is the idea of answering a question about an input image, to thereby better understand the contentsof the image. For example, for the image depicting a tennis match, a question might be “what is the tennis player holding?” and an answer to the question may be “a tennis racket”. To do so, the ML model may further comprise a semantic parsing module. In this case, obtaining a training dataset may comprise obtaining a training dataset comprising a plurality of images, and at least one question and answer pair for each image, where the question is a natural language question related to the at least two objects in the image and the answer is a ground truth natural language answer to the question.

[0022] In this example, the method may further comprise, for each image: inputting the question of the at least one question and answer pair into the semantic parsing module; and generating, using the semantic parsing module, a programmatic query concerning the at least two objects in the image.

[0023] In this example, the method may further comprise, for each image: inputting the programmatic query into the symbolic module of the ML model; wherein outputting, from the symbolic module, a plurality of possible relationships comprises outputting a plurality of possible relationships which satisfy the programmatic query.

[0024] In this example, training the ML model may further comprise training the ML model by: generating a natural language answer to the question of the at least one question answer pair; calculating a further loss by comparing the generated answer to the ground truth answer; and updating weights of one or both of the neural module and the symbolic module based on the calculated further loss.

[0025] In a second approach of the present techniques, there is provided a method for controlling an electronic device using a trained machine learning, ML, model (where the model has been trained using the techniques described herein), the method comprising: receiving an input image for processing, the input image depicting at least two objects; processing the input image by: using a trained neural module of the trained ML model to output a bounding box around each object in the input image and features of the object in each bounding box; and using a trained symbolic module of the trained ML model to output a label for the object in each bounding box and a relationship between the at least two objects depicted in the image; and controlling the electronicdevice based on the labels for the at least two objects and the relationship between the objects.

[0026] In a third approach of the present techniques, there is provided an electronic device comprising: at least one processor coupled to memory, for: receiving an input image for processing, the input image depicting at least two objects; processing the input image by: using a trained neural module of a trained ML model to output a bounding box around each object in the input image and features of the object in each bounding box; and using a trained symbolic module of the trained ML model to output a label for the object in each bounding box and a relationship between the at least two objects depicted in the image; and controlling the electronic device based on the labels for the at least two objects and the relationship between the objects.

[0027] The following features apply equally to the second and third approaches.

[0028] The electronic device may be a constrained-resource device, but which has the minimum hardware capabilities to use a trained neural network / ML model. The electronic device may be any one of: a smartphone, tablet, laptop, computer or computing device, virtual assistant device, a vehicle, an autonomous vehicle, a robot or robotic device, a robotic assistant, image capture system or device, an augmented reality system or device, a virtual reality system or device, a gaming system, an Internet of Things device, or a smart consumer device (such as a smart fridge, smart oven or smart vacuum cleaner). It will be understood that this is a non-exhaustive and non-limiting list of example devices.

[0029] The electronic device may further comprise at least one image capture device for capturing the input image.

[0030] In one example, the electronic device may be a controllable autonomous or semi-autonomous electronic device for performing a task in an environment comprising at least two objects. In this case, the input image may be an image captured of the environment; and the at least one processor may control the autonomous or semi- autonomous electronic device using the labels for the at least two objects and the relationship between the objects.

[0031] For example, the environment may be a home or kitchen, or other domestic, office or factory / warehouse environment, in which the controllable electronic device is performing a task, such as moving an object relative to another object.

[0032] The electronic device may further comprise at least one gripper. The at least one processor may control the gripper to interact with one or more of the at least two objects based on the labels for the at least two objects and the relationship between the objects.

[0033] For example, the controllable electronic device may need to pick up a spoon from a bowl – in this example, the environment comprises at least the bowl and the spoon, both of which are objects in the environment. In this example, the controllable electronic device is controlled to move the bowl and the spoon relative to each other in a logically consistent manner. The controllable electronic device needs to understand that the spoon is inside the bowl, so that the spoon can be picked up.

[0034] The electronic device may further comprise a system for moving the electronic device through the environment. The at least one processor may control the system based on the labels for the at least two objects and the relationship between the objects, so that the device does not bump into objects or try to move through solid objects.

[0035] In another example, the electronic device may be a wearable augmented reality device for controlling virtual objects blended into a real-world environment comprising at least one real object. Here, the input image may be an image of the real- world environment; and the at least one processor may use the labels for the at least two objects and the relationship between the objects to control virtual objects correctly with respect to the at least one real object. This may be useful so that the virtual objects correctly interact with the real-world object(s) and do not violate any physical rules of the real-world environment.

[0036] In a related approach of the present techniques, there is provided a computer-readable storage medium comprising instructions which, when executed by a processor, causes the processor to carry out any of the methods described herein.

[0037] The apparatus may be a constrained-resource device, but which has the minimum hardware capabilities to use a trained neural network / ML model. Theapparatus may be any one of: a smartphone, tablet, laptop, computer or computing device, virtual assistant device, a vehicle, an autonomous vehicle, a robot or robotic device, a robotic assistant, image capture system or device, an augmented reality system or device, a virtual reality system or device, a gaming system, an Internet of Things device, or a smart consumer device (such as a smart fridge). It will be understood that this is a non-exhaustive and non-limiting list of example apparatuses.

[0038] In a related approach of the present techniques, there is provided a computer-readable storage medium comprising instructions which, when executed by a processor, causes the processor to carry out any of the methods described herein.

[0039] As will be appreciated by one skilled in the art, the present techniques may be embodied as a system, method or computer program product. Accordingly, present techniques may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects.

[0040] Furthermore, the present techniques may take the form of a computer program product embodied in a computer readable medium having computer readable program code embodied thereon. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. A computer readable medium may be, for example, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing.

[0041] Computer program code for carrying out operations of the present techniques may be written in any combination of one or more programming languages, including object oriented programming languages and conventional procedural programming languages. Code components may be embodied as procedures, methods or the like, and may comprise sub-components which may take the form of instructions or sequences of instructions at any of the levels of abstraction, from the direct machine instructions of a native instruction set to high-level compiled or interpreted language constructs.

[0042] Embodiments of the present techniques also provide a non-transitory data carrier carrying code which, when implemented on a processor, causes the processor to carry out any of the methods described herein.

[0043] The techniques further provide processor control code to implement the above-described methods, for example on a general purpose computer system or on a digital signal processor (DSP). The techniques also provide a carrier carrying processor control code to, when running, implement any of the above methods, in particular on a non-transitory data carrier. The code may be provided on a carrier such as a disk, a microprocessor, CD- or DVD-ROM, programmed memory such as non-volatile memory (e.g. Flash) or read-only memory (firmware), or on a data carrier such as an optical or electrical signal carrier. Code (and / or data) to implement embodiments of the techniques described herein may comprise source, object or executable code in a conventional programming language (interpreted or compiled) such as Python, C, or assembly code, code for setting up or controlling an ASIC (Application Specific Integrated Circuit) or FPGA (Field Programmable Gate Array), or code for a hardware description language such as Verilog (RTM) or VHDL (Very high speed integrated circuit Hardware Description Language). As the skilled person will appreciate, such code and / or data may be distributed between a plurality of coupled components in communication with one another. The techniques may comprise a controller which includes a microprocessor, working memory and program memory coupled to one or more of the components of the system.

[0044] It will also be clear to one of skill in the art that all or part of a logical method according to embodiments of the present techniques may suitably be embodied in a logic apparatus comprising logic elements to perform the steps of the above- described methods, and that such logic elements may comprise components such as logic gates in, for example a programmable logic array or application-specific integrated circuit. Such a logic arrangement may further be embodied in enabling elements for temporarily or permanently establishing logic structures in such an array or circuit using, for example, a virtual hardware descriptor language, which may be stored and transmitted using fixed or transmittable carrier media.

[0045] In an embodiment, the present techniques may be realised in the form of a data carrier having functional data thereon, said functional data comprising functional computer data structures to, when loaded into a computer system or network andoperated upon thereby, enable said computer system to perform all the steps of the above-described method.

[0046] The method described above may be wholly or partly performed on an apparatus, i.e. an electronic device, using a machine learning or artificial intelligence model. The model may be processed by an artificial intelligence-dedicated processor designed in a hardware structure specified for artificial intelligence model processing. The artificial intelligence model may be obtained by training. Here, "obtained by training" means that a predefined operation rule or artificial intelligence model configured to perform a desired feature (or purpose) is obtained by training a basic artificial intelligence model with multiple pieces of training data by a training algorithm. The artificial intelligence model may include a plurality of neural network layers. Each of the plurality of neural network layers includes a plurality of weight values and performs neural network computation by computation between a result of computation by a previous layer and the plurality of weight values.

[0047] As mentioned above, the present techniques may be implemented using an AI model. A function associated with AI may be performed through the non-volatile memory, the volatile memory, and the processor. The processor may include one or a plurality of processors. At this time, one or a plurality of processors may be a general purpose processor, such as a central processing unit (CPU), an application processor (AP), or the like, a graphics-only processing unit such as a graphics processing unit (GPU), a visual processing unit (VPU), and / or an AI-dedicated processor such as a neural processing unit (NPU). The one or a plurality of processors control the processing of the input data in accordance with a predefined operating rule or artificial intelligence (AI) model stored in the non-volatile memory and the volatile memory. The predefined operating rule or artificial intelligence model is provided through training or learning. Here, being provided through learning means that, by applying a learning algorithm to a plurality of learning data, a predefined operating rule or AI model of a desired characteristic is made. The learning may be performed in a device itself in which AI according to an embodiment is performed, and / o may be implemented through a separate server / system.

[0048] The AI model may consist of a plurality of neural network layers. Each layer has a plurality of weight values, and performs a layer operation through calculation of a previous layer and an operation of a plurality of weights. Examples of neural networks include, but are not limited to, convolutional neural network (CNN), deep neural network (DNN), recurrent neural network (RNN), restricted Boltzmann Machine (RBM), deep belief network (DBN), bidirectional recurrent deep neural network (BRDNN), generative adversarial networks (GAN), and deep Q-networks.

[0049] The learning algorithm is a method for training a predetermined target device (for example, a robot) using a plurality of learning data to cause, allow, or control the target device to make a determination or prediction. Examples of learning algorithms include, but are not limited to, supervised learning, unsupervised learning, semi-supervised learning, or reinforcement learning. Brief Description of Drawings

[0050] Implementations of the present techniques will now be described, by way of example only, with reference to the accompanying drawings, in which:

[0051] Fig. 1 is a block diagram of a neuro-symbolic machine learning, ML, model.

[0052] Fig. 2 is a schematic diagram illustrating how a neuro-symbolic ML model can be trained using partial-label learning.

[0053] Fig.3 is a flowchart of example steps in a method for training a machine learning model to perform an image processing task.

[0054] Fig.4 is a schematic diagram of an example in which the neuro-symbolic model is trained by using visual question answering.

[0055] Fig.5 is a flowchart of example steps for controlling an electronic device using a trained machine learning, ML, model.

[0056] Fig.6 is a block diagram of an electronic device, which can be controlled based on the outputs of a trained ML model.

[0057] Fig. 7 shows an example image, and a set of rules used to infer new knowledge or relationships based on low-level predictions made for the image. Description of Embodiments

[0058] Broadly speaking, embodiments of the present techniques provide a method for training neuro-symbolic ML models through partial label learning, to improve the accuracy of the predictions of the ML models. Advantageously, the present techniques provide a training method which improves how well the ML model is trained, by reducing the training problem to that of partial label learning. In other words, the present techniques train the neural module through partial label learning, rather than conventional multi-class learning techniques.

[0059] Training deep machine learning models, such as deep neural networks, is a data-hungry task. Logic has been proposed as a means to train deep models in a weak fashion, overcoming the need to provide annotated labelled data, which can be very time-consuming to label. Multiple so-called neurosymbolic techniques have been proposed for training deep models using logical theories and symbolic constraints.

[0060] Neurosymbolic techniques have shown their merits in a multitude of scenarios including visual question answering (VQA) (i.e., answering queries over input images), and scene graph generation (i.e., understanding the objects occurring in an image and their inter-relations). An example of a neurosymbolic technique is that of DeepProbLog (Robin Manhaeve et al.). DeepProbLog proposes an architecture in which a logical theory is used to reason over the predictions of neural classifiers, by treating the predictions of the neural classifiers as probabilistic facts.

[0061] Despite its merits, DeepProbLog-based training faces many limitations, which are described below in relation to several examples based on VQA. In brief, the limitations relate to using very weak supervision signal as, thus, distracting the classifier (see Example 2 below), using contradicting supervision signals (see Example 3 below), and not taking into account proper side-away information (see Example 4 below). The present techniques aim to address the limitations described in more detail below.

[0062] Figure 1 is a block diagram of a neuro-symbolic machine learning, ML, model 100. The ML model 100 comprises a neural module ^^ 102, a translator module^^ 104 and a symbolic module ^^ 106. It will be appreciated that the term “neuro-symbolic framework” is used interchangeably herein with “neuro-symbolic machine learning model”. ML models configured in this manner, wherein the modules are arranged in a sequence, are termed stratified neuro-symbolic frameworks.

[0063] Each module 102, 104, 106 in such frameworks can be understood to be performing a mapping of its inputs, wherein each mapping provides an output. The outputs of these mappings comprise the outputs of each module. The function of the neural module 102 is to perform a mapping of an input vector ^^ 108, where the output of the neural module is of an appropriate form to serve as input to a translator module 104. Correspondingly, the primary function of the translator module 104 is to transform the output of the neural module 102 such that the output of the translator module 104 is of an appropriate form to serve as input to a symbolic module 106.

[0064] The symbolic module 106 adopts a logical theory ^^, and the mapping of the symbolic module 106 has a target output ^^ 110 when logically reasoning over the output provided by translator module. In the context of image classification tasks, conventional models (i.e. models that are not neuro-symbolic frameworks) are trainedon training data of the form (^^, ^^), where ^^ is an input vector an ^^ is a label providinginformation on the ground-truth class of ^^. In other words, ^^ is the ground-truth label of the input vector ^^ and the target of conventional models is to learn the ground-truth labels. However, for models that are neuro-symbolic frameworks, rather than takingthe conventional form (^^, ^^), the training data takes the form (^^, ^^). Here, ^^ is a targetoutput of the symbolic module ^^. That is, in the context of neuro-symbolic frameworks, the training data provides no information on the ground-truth class of ^^. Instead, the training data provides information on a target output ^^ of a symbolic module ^^ under a logical theory ^^.

[0065] The target output ^^ is best understood as follows. During the process of training a neuro-symbolic framework, the neural module ^^ provides a set of predicted classifications ^^ given the input feature vector ^^. In a conventional training process, the loss function is evaluated at this stage by comparing the set of predicted classifications ^^ with the corresponding labels. However, rather than evaluating the loss function at this stage, neuro-symbolic frameworks process the predictedclassifications further using the translator ^^ and symbolic ^^ modules. The primarypurpose of the translator module ^^ is to translate the predictions ^^ into a form that is suitable for performing logical reasoning over the predictions. That is, the translator module 104 maps the predictions from the form ^^ provided by the neural module 102to a set of translated predictions ^^ such that logical reasoning may be performed by the symbolic module ^^ over the translated predictions ^^.

[0066] Logical reasoning is performed by a symbolic module 106 according tothe rules of a logical theory ^^ . That is, the result of the logical reasoning by thesymbolic module 106 is an output ^^. However, the symbolic module 106 may have a target output ^^. In order to have reached the target output ^^, the translated predictions ^^, and therefore the neural module 102 predictions ^^ should have taken a particular form or adopted specific values in order to reach the target output ^^. As a result, it is not possible to evaluate a loss function using the direct output of the neural module 102. Instead, it is necessary to also account for the output of the symbolic module 106.

[0067] Therefore, the training of neuro-symbolic frameworks is less well-defined than the training of conventional machine learning models that use ground-truth class information. In particular, current techniques for training neuro-symbolic frameworks do not provide guarantees on how well the neural modules in such frameworks are trained.

[0068] The present techniques aim to provide statistical guarantees on the accuracy of neural modules in neuro-symbolic frameworks. A key idea behind the present techniques is the reduction of the task of conventional multi-class learning to a task of partial label learning. The task of conventional multi-class learning is now briefly summarised to illustrate the difference with partial label learning.

[0069] Multi-class learning: Let ^^ denote the input space and ^^ = {1, … ,denote the output space. Let ^^ be a density function over ^^ × ^^ . The goal ofconventional multi-class learning is to learn a classifier ^^: ^^ → ℝ^ that minimizes anestimator ^^(^^) = ^^[ℓ(^^(^^), ^^^)] with ^^ denoting expectation, (^^, ^^) denoting pairsof random variables (RVs) distributed according to ^^, ℓ denoting a proper loss function, i.e., a function that is continuous, non-negative and becomes zero when its two arguments are equal, and ^^^denoting the one-hot encoding vector.

[0070] The difference between conventional multi-class learning and partiallabel learning is that the training data is not of the form (^^, ^^) ∈ ^^ × ^^ but of the form(^^, ^^) ∈ ^^ × ^^, where ^^ includes each element in the powerset of ^^ apart from the ∅and ^^ itself. That is, for each ^^ we are provided with a set of labels instead of a single label. The only requirement is that the target set must include the actual label of ^^.

[0071] Partial-label learning: Let ^^′ be a density function over ^^ × ^^. The goalof partial label learning is to learn a classifier ^^: ^^ → ℝ^ that minimizes an estimator^^)] with (^^, ^^) denoting pairs of RVs distributed accordingto ^^ᇱand ℓ^^^denoting a proper loss function. Therefore, the primary difference between ordinary multi-class learning and partial label learning is the form of the training data; instead of being provided with a single label corresponding to the ground- truth class of each input vector ^^, a plurality of labels is provided.

[0072] To reduce the task of conventional multi-class learning to a task of partial label learning, techniques from logic are used, with consequential modifications made to the architecture of the neural module 102. In particular, logical abduction or abductive reasoning may be used. A brief summary of the concepts used from abduction will now be provided. However, it will be appreciated that logical abduction / abductive reasoning is provided by way of example only, and that other forms of logical reasoning may be used.

[0073] Abduction: Abductive reasoning is about finding the root causes of an observation. So, abductive reasoning aims to tell you *all the possible reasons* something holds. For example, suppose that you want to ask if there is a path from node a to node c in a graph (this becomes your query Q = path(a,c)). Suppose that the theory tells you that there is a path between two nodes, if either these two nodes are connected via an edge, or if there are paths via an intermediate node, i.e., theory T has the two rules:

[0074] edge(X,Y) => path(X,Y) path(X,Z) AND path(Z,Y) => path(X,Y)

[0075] Finally, suppose that you have the following edges: edge(a,b), edge(b,c), edge(a,d), edge(d,c).

[0076] Then, abduction will return you all the possible ways a path is formed between a and b, i.e.,

[0077] φ = edge(a,b) AND edge(b,c) OR edge(a,d) AND edge(d,c).

[0078] In the case of logical abduction, the aim of abductive reasoning is to find or calculate abductive formulae ^^ given a logical theory ^^, a plurality of abduciblepredicates ^^, a set of integrity constraints Σ and a user query ^^, such that ^^ ∪ ^^ ⊨ ^^and ^^ ∪ ^^ ⊨ Σ. Each abductive formula ^^ may be a combination of disjunctions andconjunctions. In essence, the plurality of abducible predicates ^^ serves as the primary input into the abductive reasoning. In the context of abduction for the training of neuro- symbolic frameworks, the plurality of abducible predicates ^^ may be generated from an initial training dataset. The plurality of abducible predicates ^^ may be generated by a translator module 104 from an initial training dataset by obtaining an initial training dataset; processing, using a neural module 102, the initial training dataset to generate a processing result; and translating, using a translator module 104, the processing result into a plurality of abducible parameters.

[0079] The present techniques use logical theories ^^ where ^^ is a disjunction over conjunctions, where each conjunction includes ^^-atoms only. Each conjunction is referred to as an explanation. In other words, the aim of abductive reasoning may also be understood as calculating a plurality of conjunctions or, equivalently, a plurality of logical explanations ^^. With respect to abduction, the explanations may be in the form of abductive formulae. The plurality of logical explanations, calculated using abduction and a plurality of abducible predicates, may be used to modify the architecture of the neural module 102. As noted above, it will be appreciated modifying the architecture of the neural module 102 using abduction as a form of logical reasoning is provided by way of example only, and that other appropriate forms of logical reasoning may be used. In other words, logical reasoning may be used to modify the architecture of a neural module 102 according to the present techniques.

[0080] Figure 2 is a schematic diagram illustrating how a neuro-symbolic ML model can be trained using partial-label learning. The training method is illustrated using an exemplary task of training a neuro-symbolic framework for the addition of two digits using abduction. In this example, the neural module 102 identifies that the input images contain single digits. In this example, the neural module 102 comprises a first deep neural network, DNN, 200 and a second deep neural network, DNN 202, the two deep neural networks configured to extract features of input images in order for theimages to be classified. It will be understood that a single DNN or multiple DNNs may be sufficient for analysing the input images, and that the specific example shown in Figure 2 is non-limiting. In this specific example, the DNN outputs features that can be used to determine that the image depicts any of the integers between 0 and 9. That is, each of the DNNs provides an output which indicates the digit in the correspondingimage may be any of the integers {0, … ,9}. Thus, in the example shown in Figure w,the first and second DNNs are provided with a first image 204 and a second image 206, each depicting a digit, as input. Therefore, for each image, there is a total of ten possibilities for the digit being depicted in the image.

[0081] Thus, in terms of the sum of the two digits, there is a space of 100 possible explanations for the sum. For instance, the features extracted using the first DNN 200 may suggest the integer 2 is depicted in image 204, while the features extracted using the second DNN 202 may suggest the integer 4 is depicted in image 204. Therefore, a possible explanation for the sum may be 6.

[0082] An additional output layer ^^′ 208 is shown in Figure 2. As noted above, the additional output layer 208 may have the same number of nodes as the number of explanations in the plurality of logical explanations. In this case, the additional output layer comprises 100 neurons, as there are 100 explanations (i.e. possible outcomes) in the plurality of logical explanations.

[0083] Furthermore, for each of the ^^ nodes in ^^′, an edge is added from the ^^-th node in the original output layer ^^ (i.e. the output layer before the introduction of the additional output layer) to the additional output layer, wherein an edge is only added in the case that the translator mapping ^^(^^) of the ^^-th neuron in ^^′ occurs in the ^^-th explanation in ^^. Here, the term “edge” is used to mean a non-zero weight between two nodes of a neural network.

[0084] As noted above, the method comprises generating, from the initial training dataset, a modified training dataset, wherein the initial training dataset is of theform (^^, ^^), where ^^ is a target output of a logical theory ^^ and ^^ is an input featurevector. In this example, the logical theory ^^ corresponds to the arithmetic rules of addition encoded in a logical form, and the target output ^^ corresponds to a chosen target sum for the addition of two digits. In this case, the target sum is chosen to be 5,denoted as ^^^^^^(^^^, ^^ଶ, 5), where ^^^ and ^^ଶ correspond to the integers depicted in theimages provided as input to the first and second DNNs, respectively. The input feature vector corresponds to a representation of the input image. For example, the input feature vector may correspond to a matrix of pixel brightnesses.

[0085] As noted above, the generation of the modified training dataset may comprise, for each data item in the initial training dataset: calculating, using the logical theory of the symbolic module 106, an abductive formula, the abductive formula comprising a plurality of logical explanations. The example shown in Figure 2 shows an example of such a calculation for single entry in the initial training dataset, the first image 204 depicting the integer 1 and the second image 206 depicting the integer 4. An example of an abductive formula comprising a plurality of logical explanations 210 is shown in Figure 2. The plurality of logical explanations comprises the possible combinations of classified digits that satisfy the target output, which is that the integers of depicted in the first and second images sum to 5. Each explanation in the plurality of logical explanations is assigned a corresponding label, denoted^^^^^^^^^^ ^^^ହ, … , ^^^^^^^^^^ ^^ଶସ, to generate a plurality of partial labels 212. A modified trainingdataset 214 is generated by combining the plurality of partial labels 212 with the plurality of logical explanations 210 of the abductive formula.

[0086] According to the present techniques, the partial label learning comprises the minimization of a loss function. Without loss of generality, the loss function

[0088] may be minimized as part of the partial label learning of the neural module, where ℓ^^^is the partial label learning, PLL, loss and ℓ is a conventional loss function, such as the cross-entropy loss or mean-squared error loss functions. It will be appreciated that the loss function shown in Eq. (1) above is provided by way of example only, and that other appropriate loss functions may be used. The use of the loss function in Eq. (1) results in the following well-known bound for partial label learning on the difference between the empirical risk classifier and an optimal classifier:

[0089] ൫ ^^^^^మ ഃ^^^௬൯ + 2^^ଶ|ℰ| (2)

[0090] where n^^^^is the empirical risk classifier, n∗^^^^^^is the optimal classifier, ^^ is the size of the training set and (^^௬) is the expected Rademacher complexity ofℋ௬ for ^^ and ℋ௬ is the function space for label ^^ ∈ {1, … , |ℰ|} defined as ^ℎ: ^^ →n௬(^^)หn ∈ ^^} with ^^ being the space of classifiers. It will be appreciated that it ispossible to obtain alternative bounds via other partial label learning techniques. The bounds essentially provide guarantees on the accuracy of the trained model.

[0091] Figure 3 is a flowchart of example steps in a method for training a machine learning model to perform an image processing task. The method comprises: obtaining a training dataset comprising a plurality of images, each image depicting at least two objects (step S100); for each image of the plurality of images: inputting the image into a neural module of the ML model, wherein the neural module is trained to output a bounding box around each object in an image; outputting, from the neural module, a bounding box around the at least two objects in the input image and features of the object in each bounding box (step S102); inputting the output from the neural module into a symbolic module of the ML model, wherein the symbolic module is trained to: output a plurality of possible labels based on the features of the object in each bounding box, and output a plurality of possible relationships between objects in each pair of bounding boxes; outputting, from the symbolic module, a plurality of possible labels derived for each bounding box in the image, and a plurality of possible relationships between objects in each pair of bounding boxes (step S104); generating a new partially-labelled training dataset comprising the training dataset and the bounding boxes output from the neural model and the possible labels and possible relationships output by the symbolic module for each image of the training dataset (step S106); and training the ML model (step S108) by: calculating a loss by comparing the plurality of possible labels and the plurality of possible relationships derived for each image with a ground truth label for the image; and updating weights of one or both of the neural module and the symbolic module based on the calculated loss.

[0092] At step S104, outputting, from the symbolic module, a plurality of possible labels may comprise: generating, using a set of logical rules specifying constraints specific to the training dataset and the features of the object in each bounding box, the plurality of possible labels for the object in each bounding box. For example,if the aim of the machine learning model is to perform the addition of two integers to obtain a known target total, where the two integers are obtained in the form of two images of single digits, then the set of logical rules may comprise combinations of integers whose sum would equal the target total. The rules constrain the predictions made by the symbolic module. Similarly, in the tennis example, the aim of the ML model may be to understand who in the image is playing tennis. The rules in this case may include the rules of tennis, such as that there are two players, the game involves rackets and a ball, and each player stands on either side of a net. This may help to narrow down which of the four people are playing tennis, and which people are umpiring or retrieving balls.

[0093] At step S104, outputting, from the symbolic module, plurality of possible relationships comprises, for each pair of bounding boxes in an image, may comprise: generating, using a set of logical rules specifying constraints specific to the training dataset and the plurality of possible labels for the object in each bounding box of the pair of bounding boxes, the plurality of possible relationships between the objects in the pair of bounding boxes. As noted above, the rules help to constrain the possible outputs of the symbolic module. In this case, the rules may help to determine the relationships between objects. For example, “player 1 is holding a racket”, “the ball girl is standing by the net”, and “player 1 is playing a tennis match against player 2”.

[0094] In some cases, the image being processed may be a single image or frame of a video. In this case, the generating may comprise using a set of logical rules defining likely relationships for objects within a single image or frame. That is, the logical rules may define local rules for single images / frames. For example, if an image shows one person walking across a road, then there is a good chance other people in the image may also be walking across the road. One rule may be therefore that if two objects are close to each other in the same image / frame, then they are likely to be performing the same action. Similarly, if there are many people in the same image (e.g. image of a start line for a marathon or image of people inside a supermarket), then they may all be doing the same thing.

[0095] In some cases, the image being processed may not be a single image / frame, but may comprise a plurality of adjacent frames of a video. In this case,above-mentioned rules may apply to each individual frame, but the generating may also comprise using a set of logical rules defining likely relationships for objects appearing in adjacent frames. That is, the logical rules may define global rules that apply across adjacent frames. For example, if a bounding box is placed around an object in substantially the same position in adjacent frames, then it is highly likely that each bounding box shows the same object.

[0096] The logical rules may be or comprise general logical rules. For example, the logical rules may include arithmetic or other mathematical operations, or be based on laws of physics, which must hold true in all scenarios.

[0097] The logical rules may be or comprise rules that are constructed by a human user or operator and be based on real-life scenarios. For example, for images depicting a group of people crossing a road, the fact that one actor in the image has been classified as walking, and that another actor has been identified in close proximity to the walking actor, may be used to infer that the identified actor is also walking. In other words, a logical rule may be constructed to stipulate that actors in close proximity to other actors performing an action are necessarily also performing the same action.

[0098] The set of logical rules is now explained in more detail. Figure 7 shows an example image, and a set of rules used to infer new knowledge or relationships based on low-level predictions made for the image. Similarly to the example illustrated inrelation to Figure 3 above, logical theories ^^ that are more complex than thosegoverning arithmetic operations may be constructed. A logical theory ^^ comprising a number of logical rules may be constructed to make inferences about the features or characteristics of images. For example, a logical rule may be constructed to stipulate that if many actors in a given image are performing the same action, then all actors are performing that action. Another logical rule may be constructed to stipulate that actors in a given image in close proximity to one another are performing the same action. In this specific example, the rules may include the five rules shown in Figure 7, where rules involving lowercase a are defined for each action a (e.g. singing, walking, etc.). These rules relate to the following:

[0099] R1 corresponds to beliefs about local predictions.

[0100] R2 expresses the belief that if many actors in the current frame are doing a particular action, then perhaps everyone is doing that action. The FRAMELABEL predicate accumulates the LOCAL activity beliefs for all actors in the frame.

[0101] R3 enforces the effect of proximity on activity, where actors that are close in the same frame are likely to perform the same action.

[0102] R4 is used for identity maintenance and tracking. It says that if two bounding boxes occur in adjacent frames and their positions have not changed significantly, then they are likely the same actor.

[0103] It can then be reasoned, in R5, that if two bounding boxes (in adjacent frames) refer to the same actor, then they are likely to be doing the same activity.

[0104] In the example shown in Figure 7, an image 700 may depict a plurality of actors with bounding boxes. A neuro-symbolic framework may infer that the bounding box 702 depicts a person walking. By applying a logical rule, which stipulates that actors in close proximity to an actor performing a particular action are also performing that action, a neuro-symbolic framework may infer that bounding boxes 704 and 706 also depict people walking. The present techniques provide a way of training neuro- symbolic frameworks, for performing inferences like those in Figure 7, which provides guarantees on how well the neural modules of such frameworks is trained.

[0105] Returning to Figure 3, in some cases, the image processing task may comprise scene graph generation, and the method may comprise outputting, from the ML model, a scene graph. A scene graph is a data structure which arranges and represents logical connections objects in a scene. For example, if the input image shows a spoon inside a bowl on a table, the scene graph generated using the outputs of the neural and symbolic modules may be a graph with a node corresponding to the spoon, a node corresponding to the bowl, a node corresponding to the table, and a directed edge between these the spoon and bowl nodes indicating the relationship between the spoon and the bowl, and a directed edge between the bowl and table nodes indicating the relationship between the bowl and table. The graph may indicate that the spoon is inside the bowl (correct relationship), or that the bowl is inside the spoon (incorrect relationship).

[0106] In some cases, the image processing task may comprise action recognition. In this case, outputting, from the neural module, a bounding box around the at least two objects may comprise outputting a bounding box around the at least two actors within the image; and outputting, from the symbolic module, a plurality of possible labels and a plurality of possible relationships may comprise outputting a plurality of possible actions performed by each actor, and a plurality of possible relationships between the actors in each pair of bounding boxes.

[0107] Figure 4 is a schematic diagram of an example in which the neuro- symbolic model is trained by using visual question answering. Visual question answering is the idea of answering a question about an input image, to thereby better understand the contents of the image. For example, for the image depicting a tennis match, a question might be “what is the tennis player holding?” and an answer to the question may be “a tennis racket”. To do so, the ML model may further comprise a semantic parsing module 400. In this case, obtaining a training dataset may comprise obtaining a training dataset comprising a plurality of images, and at least one question and answer pair for each image, where the question is a natural language question related to the at least two objects in the image and the answer is a ground truth natural language answer to the question. In Figure 4, a single image is shown together with a single question and answer pair, for the sake of simplicity.

[0108] In this example, the method may further comprise, for each image: inputting the question of the at least one question and answer pair into the semantic parsing module 400; and generating, using the semantic parsing module 400 of the ML model, a programmatic query concerning the at least two objects in the image.

[0109] In this example, the method may further comprise, for each image: inputting the programmatic query into the symbolic module 106 of the ML model; wherein outputting, from the symbolic module 106, a plurality of possible relationships comprises outputting a plurality of possible relationships which satisfy the programmatic query.

[0110] In this example, training the ML model may further comprise training the ML model by: generating a natural language answer to the question of the at least one question answer pair; calculating a further loss by comparing the generated answer tothe ground truth answer; and updating weights of one or both of the neural module and the symbolic module based on the calculated further loss.

[0111] Figure 5 is a flowchart of example steps for controlling an electronic device using a trained machine learning, ML, model (where the model has been trained using the techniques described herein). The method comprises: receiving an input image for processing, the input image depicting at least two objects (step S500); processing the input image by: using a trained neural module of the trained ML model to output a bounding box around each object in the input image and features of the object in each bounding box (step S502); and using a trained symbolic module of the trained ML model to output a label for the object in each bounding box and a relationship between the at least two objects depicted in the image (step S504); and controlling the electronic device based on the labels for the at least two objects and the relationship between the objects (step S506).

[0112] Figure 6 is a block diagram of an electronic device 600, which can be controlled based on the outputs of a trained ML model 100. The electronic device comprises at least one processor 602 coupled to memory 604, and storage 606.

[0113] The processor 602 may comprise one or more of: a microprocessor, a microcontroller, and an integrated circuit. The memory 604 may comprise volatile memory, such as random access memory (RAM), for use as temporary memory, and / or non-volatile memory such as Flash, read only memory (ROM), or electrically erasable programmable ROM (EEPROM), for storing data, programs, or instructions, for example.

[0114] The processor 602 may be arranged for: receiving an input image for processing, the input image depicting at least two objects; processing the input image by: using a trained neural module of a trained ML model to output a bounding box around each object in the input image and features of the object in each bounding box; and using a trained symbolic module of the trained ML model to output a label for the object in each bounding box and a relationship between the at least two objects depicted in the image; and controlling the electronic device based on the labels for the at least two objects and the relationship between the objects.

[0115] The following features apply equally to Figures 5 and 6.

[0116] The electronic device 600 may be a constrained-resource device, but which has the minimum hardware capabilities to use a trained neural network / ML model. The electronic device may be any one of: a smartphone, tablet, laptop, computer or computing device, virtual assistant device, a vehicle, an autonomous vehicle, a robot or robotic device, a robotic assistant, image capture system or device, an augmented reality system or device, a virtual reality system or device, a gaming system, an Internet of Things device, or a smart consumer device (such as a smart fridge, smart oven or smart vacuum cleaner). It will be understood that this is a non-exhaustive and non- limiting list of example devices.

[0117] The electronic device 600 may further comprise at least one image capture device 608 for capturing the input image.

[0118] In one example, the electronic device 600 may be a controllable autonomous or semi-autonomous electronic device for performing a task in an environment comprising at least two objects. In this case, the input image may be an image captured of the environment; and the at least one processor may control the autonomous or semi-autonomous electronic device using the labels for the at least two objects and the relationship between the objects.

[0119] For example, the environment may be a home or kitchen, or other domestic, office or factory / warehouse environment, in which the controllable electronic device is performing a task, such as moving an object relative to another object.

[0120] The electronic device 600 may further comprise at least one gripper (not shown). The at least one processor may control the gripper to interact with one or more of the at least two objects based on the labels for the at least two objects and the relationship between the objects.

[0121] For example, the controllable electronic device may need to pick up a spoon from a bowl – in this example, the environment comprises at least the bowl and the spoon, both of which are objects in the environment. In this example, the controllable electronic device is controlled to move the bowl and the spoon relative to each other in a logically consistent manner. The controllable electronic device needs to understand that the spoon is inside the bowl, so that the spoon can be picked up.

[0122] The electronic device 600 may further comprise a system (not shown) for moving the electronic device through the environment. The at least one processor may control the system based on the labels for the at least two objects and the relationship between the objects, so that the device does not bump into objects or try to move through solid objects.

[0123] In another example, the electronic device may be a wearable augmented reality device for controlling virtual objects blended into a real-world environment comprising at least one real object. Here, the input image may be an image of the real- world environment; and the at least one processor may use the labels for the at least two objects and the relationship between the objects to control virtual objects correctly with respect to the at least one real object. This may be useful so that the virtual objects correctly interact with the real-world object(s) and do not violate any physical rules of the real-world environment.

[0124] Some theoretical underpinnings of the present techniques are now explained, for completeness.

[0125] Preliminaries. The common notions related to logic and probabilistic programming are summarized below. Symbols ⊤, ⊥ denote the logical true and false, respectively. An atom is a formula of the form ^^(^^), where ^^ is a predicate and ^^ is a tuple of constants or variables. Atoms that have no variables as arguments are calledfacts. A rule is a formula of the form ^^(^^)^^^(^^^), where ^^ and ^^^, for 1 ≤ ^^ ≤ ^^are tuples of constants and variables. The present techniques adopt Datalog (Serge Abiteboul et al.), a language widely used in neurosymbolic AI, according to which each variable occurring in the conclusion, also occurs in the premise. Notice that a fact can be represented as a rule with an empty premise. A logic program or simply, program, is a set of rules. Symbol ⊨ denotes logical entailment, where sets of atoms and rules are viewed as first-order theories.

[0126] In the present techniques, supervision is provided via conjunctive queries (CQs) (Ashok K. Chandra et al.). A CQ ^^ can be represented as a Datalog rule with a distinct predicate in its conclusion (denoted as ^^ for brevity). An answer to a CQ ^^over a program ^^ is a tuple of constants ^^ so that ^^ ⊨ ^^(^^).

[0127] Probabilistic logic programs (PLPs) extend traditional programs by treating each input fact (notice that it is possible to assign probabilities also to the rules by adding extra “dummy” facts to the rule premises with probabilities equal to that of the rules) as an independent Bernoulli random variable that becomes true (resp. false)with a fixed probability ^^ (resp.1 − ^^). Differently from traditional programs, eachderived fact is true with some probability. The present techniques adhere to the widely- adopted possible world semantics (Dan Suciu et al., Jiani Huang et al.).

[0128] In deep learning, learning a classifier ℎ^: ^^^ → ^^^, where ^^ ^ = {1, … , ^^^}and ^^^ > 1 , reduces to learning a scoring function ^^^: ^^^ → [0,1]^^^. Then, the prediction of classifier ℎ^in x is defined ^^^^^^max^^ ^ ^^(^^) , where ^^^^(^^) denotes thevalue of the ^^-th output element of ^^^(^^). We use ^^^∗(^^) to denote the score of ℎ^’s prediction on and ^^∗to denote that prediction.

[0129] Neural predicates are the components that enable learning via entailment. For a scoring function ^^^and an input , a neural predicate ^^^(for brevity, we use the same symbol to refer to a neural predicate and its associated classifier) models in relational form the outputs of ^^^when provided with ^^. In particular, an atom of theform is created for each class ^^ ∈ ^^^, with probability equal to ^^ ^^(^^). Each ^^^induces a probability distribution via a softmax layer. Hence,∑^∈^^^ ^ ^^^(^^) = 1 holdsfor each ^^^, while the predictions are mutually exclusive.

[0130] Problem Statement. The present techniques employ a stratified setting in which the predictions of one or more scoring functions are reasoned on top of by using a fixed program ^^. To ease the presentation, it is assumed that ^^ is non-probabilistic; however, the below discussion can be easily extended when ^^ is probabilistic. It isassumed that ^^ independent scoring functions ^^ = (^^^, … ,and use ^^ to denote thetrainable weights of all the ^^^’s. The variable ^^ is used to denote the inputs to ^^, where^^ may comprise one or more inputs per ^^^. As described in above, providing ^^^, … , ^^ெwith ^^ leads to the creation of a database ^^^^(^^) that includes for each ^^^, each ^^ ∈ ^^^ andeach input ^^ ∈ ^^ to ^^^, exactly one probabilistic fact ^^^(^^, ^^). Due to the above, QA inthe present techniques reduces to QA over the PLP ^^ ∪ ^^^^(^^) . ^^(^^ = ^^|^^, ^^, ^^) is usedto denote the probability that the truth value of atom ^^ is ^^ ∈ {⊤, ⊥} under ^^, ^^ and ^^.When the context is clear, ^^(^^ = ^^) is simply used. Notice that ^^(^^ =⊥) = 1 −^^(^^ = ⊤).

[0131] The problem of learning via entailment is now introduced. Let ^^ be a setof training instances. Each instance ^^ is of the form (^^, ^^, ^^, ^^), where ^^ is an input ^^,^^ is CQ, ^^ is an answer to ^^ under ^^ and and ^^ ∈ {⊤, ⊥} denotes the target truth valueof ^^ in this context. The aim of training is to amend the weights of ^^^, … , ^^ெ so that theexpectation ^^(^^,ொ,^^,ఙ)∼^[−log^^(^^ = ^^|^^, ^^, ^^)] is minimized, where ^^ denotes thedistribution of the training instances. Intuitively, training proceeds via amending the weights of the classifiers, so that the target answer probabilities match the ground truth ones. While other loss functions are also applicable, negative log likelihood is used as it is one of the most standard ones (Robin Manhaeve et al.).

[0132] It has been previously shown that the probability a derived atom is true or false in a PLP reduces to the probability of its lineage being true or false in the PLP. A proof for an atom ^^ under ^^, ^^ and ^^, or simply, a proof for ^^ when the context is clear, is a minimal subset ℱ of the facts in ^^ and ^^^^(^^) (ignoring their probabilities) so thatℱ ⊨ ^^; its lineage is the formula that results after taking the disjunction of all its proofs,after treating each proof as the conjunction of its constituting atoms. Notice that the probability the lineage formula is true adheres to the possible world semantics, to alignwith the semantics adopted for ^^ ∪ ^^^^(^^).

[0133] As the parameters of the ^^^’s are the only trainable ones (recall that ^^ is non-probabilistic), the non-neural atoms from each proof are ignored.is used todenote the lineage of an atom ^^ . ^^(^^ = ⊤) = ^^(Φఈ = ⊤) , while ^^(Φఈ =⊥) == ⊤). Based on the above, instead of providing the training instances to thelearning process, the corresponding lineage formulas can be directly provided.proofs is used to denote the proofs of lineage Φ . For a lineage formula Φ ,polarity(Φ) = ⊤; if Φ is the negation of a lineage, then polarity(Φ) =⊥.

[0134] Training in the present techniques, that is learning the parameters of the ^^^’s, proceeds via gradient descent. In particular, the partial derivatives of the loss are computed under the neural atoms occurring in the lineage of the answer atoms. Then, the loss gradients of all neural parameters are obtained via the chain rule.

[0135] Motivation. The limitations of current techniques are now introduced. The VQAR benchmark (Jiani Huang et al.) is considered, that is designed for visual question answering (VQA) using commonsense Datalog rules.

[0136] Example 1. The VQAR benchmark includes three classifiers, namely^^^^^^^^ , ^^^^^^^^ and ^^^^^^ , where ^^^ , ^^^ and ^^ ^ denote the output domains of thoseclassifiers, respectively. Given a bounding box ^^, classifiers ^^^^^^^^ and ^^^^^^^^ output the type and the properties of ^^, respectively. For a pair of bounding boxes ^^^and ^^ଶ, classifier ^^^^^^ outputs their relationship.

[0137] The benchmark includes six rules in total, three of which are shown below:

[0138] ^^^^^(^^, ^^ℎ^^^^^^) ← ^^^^^^^^(^^, ^^) (1)

[0139] ^^^^^^^^(^^, ^^) ← ^^^^^^^^(^^ᇱ, ^^) ∧ ^^^^^(^^ᇱ, ^^) (2)

[0140] ^^^^^(^^, ^^) ← ^^^^^(^^, ^^) ∧ ^^^^^(^^, ^^) (3)

[0141] Rule (1) states that every object is of type ^^ℎ^^^^^^. The second one states that if an object ^^ is of type ^^′ (e.g., jacket) and ^^′ is of type ^^ (e.g., wearable), then ^^ is of type ^^. The third rule states that ^^^^_^^ is a transitive relation. The ^^^^_^^ facts are from the CRIC ontology (Difei Gao et al.) and encode commonsense knowledge about object hierarchies.

[0142] The first limitation relates to training under non-useful supervision. This can affect both the total training time and the accuracy of the classifiers.

[0143] The second limitation relates to training under contradicting supervision signals.

[0144] Example 2. Consider the query ^^ଶ(^^, ^^′) ← ^^^^^^^^(^^^^^^^^, ^^) ∧^^^^^^(^^^^^^^^, ^^, ^^′) ∧ ^^^^^^^^(^^^^^^^^, ^^′). The query asks for all pairs of objects (^^, ^^′) forwhich ^^ is a ^^^^^^^^ , ^^′ is a ^^^^^^^^ and ^^ is left of ^^′. Assume that ^^ଶ is part of twotraining instances and that the gold answers to ^^ଶ in those instances areand(^^ଷ, ^^^) with probability one and zero, respectively. According to the lineage of the firstanswer, ^^^should be a ^^^^^^^^. In contrast, according to the lineage of the second answer and the fact that its probability should be zero, ^^^might not be a ^^^^^^^^. Thus, the two training instances provide contradicting supervision signals for ^^^.

[0145] With the aim to reduce the overhead of computing the probability of the proofs, prior art relied on top-^^ approaches. A top-^^ approach essentially computes theprobability of an answer considering only the ^^ most likely proofs. However, fixing a ^^ introduces an unnecessary overhead. In addition, it might impact the convergence of the classifiers.

[0146] Example 3. Consider the query ^^ଷ(^^) ← ^^^^^^(^^^^^^^^^^^^^^, ^^′, ^^) ∧^^^^^^^^(^^^^^^^^^^, ^^′) that asks for the cloth a teddy bear is wearing. Assuming that thegold answer to ^^ଷis ^^^and that there are five input bounding boxes in total, ^^^to ^^ହ, the lineage of ^^ଷ(^^^) is

[0147] ை∈^మ,^∨య,^ర,^ఱ ^^^^^^(^^^^^^^^^^^^^^, ^^, ^^^) ∧ ^^^^^^^^(^^^^^^^^^^, ^^) (5)

[0148] According to (5), any of ^^ଶto ^^ହcan be a teddy and, thus, we should accordingly update the weights of classifier ^^^^^^^^ to reflect this possibility. However, if classifier ^^^^^^ (i) returns with very high probability relation ^^^^^^^^^^^^^^ for the inputs ^^ଶand ^^^and (ii) returns with very low probability relation ^^^^^^^^^^^^^^ for the remaining pairs of objects, then ^^ଶis most likely a teddy. Based on the above, it is seen that fixinga ^^ , say ^^ = 5 , introduces an unnecessary computation cost. Furthermore, thesupervision strength for ^^ଶis less than what it would be and also wrongly updates the rest of the objects.

[0149] Contribution. The contributions of the present techniques are presented below. In particular, techniques for overcoming the limitations presented in Examples 2 and 3 above are presented.

[0150] Training under contradicting proofs. Example 2 demonstrates that the predictions should be chosen which are forced to become zero and which are forced to become one, respectively; otherwise, the training falls into the case in which the training is under contradicting gradients:

[0151] Definition 3. The gradients for a neural atom ^^ are contradicting, if theyare of the form ^^^^(Φ^ = ⊤) / ^^^^ and ^^^^(Φଶ =⊥) / ^^^^ and ^^ occurs in both lineageformulas

[0152] Returning back to Example 2, the gradients produced under the two training instances are contradicting, since in first case, the aim is to maximize=⊤) , while in the second one, the aim is to maximize ^^=⊥) , where Φ^ =^^^^^^^^(^^^^^^^^, ^^ଶ) ∧ ^^^^^^(^^^^^^^^, ^^ଶ, ^^^) ∧ ^^^^^^^^(^^^^^^^^, ^^^) and Φଶ = ^^^^^^^^(^^^^^^^^, ^^ଷ) ∧^^^^^^(^^^^^^^^, ^^ଷ, ^^^) ∧ ^^^^^^^^(^^^^^^^^, ^^^).

[0153] What would be a reasonable strategy to produce non-contradictinggradients? Our natural choice is to force the probability of ^^^^^^^^(^^^^^^^^,to one. Bydoing that, both objectives are satisfied,=⊥) can still be maximized by forcingthe probabilities of neural atoms ^^^^^^^^(^^^^^^^^^^^^^^^^, ^^ଷ) and ^^^^^^(^^^^^^^^, ^^ଷ, ^^^) to zero.Forcing the probability ^^^^^^^^(^^^^^^^^,to zero, would violate the objective of the firsttraining instance, that is to maximize= ⊤).

[0154] Progressive proof purification. To address the limitations from Example 3, a strategy inspired from learning in the presence of noisy data is employed. Assuming that for a noisy classifier ^^^there is a pure region in which its predictions are highly confident and ^^^is consistent with the Bayes optimal one—the one that is trained in a supervised fashion and minimized the 0-1 loss– the techniques described in Yikai Zhang et al. outline a learning technique that relies on this region to train ^^^. The intuition is that ^^^will be more accurate after being trained in this pure region and, subsequently, its new pure region will grow bigger. To turn the above intuition into a practical algorithm, the techniques of Yikai Zhang et al. rely on the confidence of ^^^to amendincorrect predictions. In particular, given a noisy training instance (^^, ^^^) , where ^^denotes the input toand ^^^ the noisy label, ^^^ is turned into ^^∗,− ^^^௬^(^^) ≥ ^^.The steps of the techniques described in Yikai Zhang et al. can be summarized to the following iterative process: firstly, the training instances are amended using a threshold ^^ as above; secondly, ^^^is trained using the amended instances; lastly, if no instance’s label is amended, ^^ is decreased and the whole process starts from the beginning.

[0155] To employ the above rationale in the present techniques, several extensions are required. Firstly, the notion of ^^-valid neural atoms is introduced.

[0156] Fix f and ^^.

[0157] Definition 4. Neural atom ^^^(^^, ^^) is ^^-valid if ^^^∗(^^) − ^^^ ^(^^) < ^^ holds.

[0158] ^^-valid neural atoms represent the predictions for which the classifiers are highly confident, as per Yikai Zhang et al.. Secondly, the above notion is generalized to proofs.

[0159] Definition 5. Given a query ^^ and a tuple of constants ^^, a proof ^^ for^^(^^) under ^^, ^^ and ^^ is ^^-valid,either:

[0160] each neural atom ^^^(^^, ^^) ∈ ^^ is ^^^-valid; or

[0161] there exist an EDB-rewriting of ^^ under ^^ and a neural atom ^^^(^^, ^^) thatis ^^^-valid, s.t. only one grounding of the EDB-rewriting under ^^^^(^^) ^^′ satisfies thefollowing:occurs in ^^(^^′).

[0162] The concept of EDB-rewritings has been introduced in Efthymia Tsamoura et al. Above, a proof is simply said to be ^^-valid, if the context is clear. Notice that a non-^^-valid proof might still includevalid neural atoms.

Claims

Claims

1. A computer-implemented method for training a machine learning, ML, model to perform an image processing task, the method comprising: obtaining a training dataset comprising a plurality of images, each image depicting at least two objects; for each image of the plurality of images: inputting the image into a neural module of the ML model, wherein the neural module is trained to output a bounding box around each object in an image; outputting, from the neural module, a bounding box around the at least two objects in the input image and features of the object in each bounding box; inputting the output from the neural module into a symbolic module of the ML model, wherein the symbolic module is trained to: output a plurality of possible labels based on the features of the object in each bounding box, and output a plurality of possible relationships between objects in each pair of bounding boxes; outputting, from the symbolic module, a plurality of possible labels derived for each bounding box in the image, and a plurality of possible relationships between objects in each pair of bounding boxes; generating a new partially-labelled training dataset comprising the training dataset and the bounding boxes output from the neural model and the possible labels and possible relationships output by the symbolic module for each image of the training dataset; and training the ML model by: calculating a loss by comparing the plurality of possible labels and the plurality of possible relationships derived for each image with a ground truth label for the image; and updating weights of one or both of the neural module and the symbolic module based on the calculated loss.

2. The method as claimed in claim 1 wherein outputting, from the symbolic module, a plurality of possible labels comprises:generating, using a set of logical rules specifying constraints specific to the training dataset and the features of the object in each bounding box, the plurality of possible labels for the object in each bounding box.

3. The method as claimed in claim 1, wherein outputting, from the symbolic module, plurality of possible relationships comprises, for each pair of bounding boxes in an image: generating, using a set of logical rules specifying constraints specific to the training dataset and the plurality of possible labels for the object in each bounding box of the pair of bounding boxes, the plurality of possible relationships between the objects in the pair of bounding boxes.

4. The method as claimed in claim 2, wherein the image is a single image or frame of a video, and the generating comprises using a set of logical rules defining likely relationships for objects within a single image or frame.

5. The method as claimed in claim 2, wherein the image comprises a plurality of adjacent frames of a video, and the generating comprises using a set of logical rules defining likely relationships for objects appearing in adjacent frames.

6. The method as claimed in claim 1, wherein the image processing task comprises scene graph generation.

7. The method as claimed in claim 1, wherein: the image processing task comprises action recognition; outputting, from the neural module, a bounding box around the at least two objects comprises outputting a bounding box around the at least two actors within the image; and outputting, from the symbolic module, a plurality of possible labels and a plurality of possible relationships comprises outputting a plurality of possible actions performed by each actor, and a plurality of possible relationships between the actors in each pair of bounding boxes.

8. The method as claimed in claim 1, wherein: the ML model further comprises a semantic parsing module; andobtaining a training dataset comprises obtaining a training dataset comprising a plurality of images, and at least one question and answer pair for each image, where the question is a natural language question related to the at least two objects in the image and the answer is a ground truth natural language answer to the question.

9. The method as claimed in claim 8 further comprising, for each image: inputting the question of the at least one question and answer pair into the semantic parsing module; and generating, using the semantic parsing module, a programmatic query concerning the at least two objects in the image.

10. The method as claimed in claim 9 further comprising, for each image: inputting the programmatic query into the symbolic module of the ML model; wherein outputting, from the symbolic module, a plurality of possible relationships comprises outputting a plurality of possible relationships which satisfy the programmatic query.

11. The method as claimed in claim 10 wherein training the ML model further comprises training the ML model by: generating a natural language answer to the question of the at least one question answer pair; calculating a further loss by comparing the generated answer to the ground truth answer; and updating weights of one or both of the neural module and the symbolic module based on the calculated further loss.

12. A method for controlling an electronic device using a trained machine learning, ML, model, the method comprising: receiving an input image for processing, the input image depicting at least two objects; processing the input image by: using a trained neural module of the trained ML model to output a bounding box around each object in the input image and features of the object in each bounding box; andusing a trained symbolic module of the trained ML model to output a label for the object in each bounding box and a relationship between the at least two objects depicted in the image; and controlling the electronic device based on the labels for the at least two objects and the relationship between the objects.

13. An electronic device comprising: at least one processor coupled to memory, for: receiving an input image for processing, the input image depicting at least two objects; processing the input image by: using a trained neural module of a trained ML model to output a bounding box around each object in the input image and features of the object in each bounding box; and using a trained symbolic module of the trained ML model to output a label for the object in each bounding box and a relationship between the at least two objects depicted in the image; and controlling the electronic device based on the labels for the at least two objects and the relationship between the objects.

14. The electronic device as claimed in claim 13 further comprising at least one image capture device for capturing the input image.

15. The electronic device as claimed in claim 13, wherein: the electronic device is a controllable autonomous or semi-autonomous electronic device for performing a task in an environment comprising at least two objects; the input image is an image captured of the environment; and the at least one processor controls the autonomous or semi-autonomous electronic device using the labels for the at least two objects and the relationship between the objects.