Method and apparatus for correcting errors in outputs of machine learning models
Broadly speaking, embodiments of the present techniques provide a method for reducing errors in the outputs of machine learning, ML, models on a potential output of the models to resolve any inconsistencies before outputting a final result from the models. The final result respects a set of rules or constraints, which may include logical constraints. Advantageously, this reduces the risk of a model outputting a result which violates some rules associated with the overall task of the model, which could be dangerous or provide a poor user experience.
1 . A computer-implemented method for detecting and correcting an error in an output of a first trained machine learning, ML, model, the method comprising:
receiving, by a communication module, an input data item to be provided to the first trained machine learning, ML, model;
providing the input data item to the first trained machine learning, ML, model, processing the input data item using the first ML model, and outputting, from the first ML model, a processing result;
providing, through the communication module, the processing result to a second trained machine learning, ML, model trained to detect an error in the processing result, and outputting, from the second ML model, information on whether there is at least one error in the processing result;
generating a masked solution by nullifying components of the processing result identified as erroneous by the second ML model;
when the output of the second ML model indicates there is at least one error in the processing result, providing, through the communication module, the masked solution to a reasoning module, correcting, using the reasoning module, each nullified component of the masked solution, and outputting, from the reasoning module, a corrected processing result for the input data item; and
jointly training the first ML model and the second ML model using the corrected processing result for the input data item.
2 . The method as claimed in claim 1 , wherein outputting a processing result from the first trained ML model comprises outputting a first vector, and wherein outputting information from the second trained ML model on whether there is at least one error in the processing result comprises generating a second vector that indicates, for each component of the first vector, whether an error is detected in that component.
3 . The method as claimed in claim 2 , wherein generating a masked solution comprises:
generating a third vector, when the second vector generated by the second ML model indicates there is at least one error in the processing result, by nullifying each component of the first vector when the second vector indicates an error in that component of the first vector.
4 . The method as claimed in claim 3 , wherein providing the masked solution in the processing result to a reasoning module comprises providing the third vector to the reasoning module; and
wherein correcting each nullified component of the masked solution comprises outputting a fourth vector, from the reasoning module, comprising corrected values for each nullified component of the first vector.
5 . The method as claimed in claim 3 , wherein correcting each nullified component of the masked solution comprises determining a correction to the detected error using at least one predetermined constraint specific to a domain to which the input data item belongs.
6 . The method as claimed in claim 3 , wherein providing the input data item comprises providing an image to the first trained ML model, and wherein processing the input data item comprises:
extracting features from the image; and
outputting a processing result using the extracted features.
7 . The method as claimed in claim 6 , wherein the image is an image of a scene depicting at least two objects, and outputting a processing result using the extracted features comprises outputting a scene graph showing a relationship between the at least two objects in the scene.
8 . An apparatus for detecting and correcting an error in an output of a first trained machine learning, ML, model, the apparatus comprising:
a communication module; and
at least one processor coupled to memory, and arranged for:
receiving, by the communication module, an input data item to be provided to the first trained machine learning, ML, model;
providing the input data item to the first trained machine learning, ML, model, processing the input data item using the first ML model, and outputting, from the first ML model, a processing result;
providing, through the communication module, the processing result to a second trained machine learning, ML, model trained to detect an error in the processing result, and outputting, from the second ML model, information on whether there is at least one error in the processing result;
generating a masked solution by nullifying components of the processing result identified as erroneous by the second ML model;
when the output of the second ML model indicates there is at least one error in the processing result, providing, through the communication module, the masked solution to a reasoning module, correcting, using the reasoning module, each nullified component of the masked solution, and outputting, from the reasoning module, a corrected processing result for the input data item; and
jointly training the first ML model and the second ML model using the corrected processing result for the input data item.
9 . The apparatus as claimed in claim 8 , further comprising:
at least one image capture device for capturing an image;
wherein providing the input data item comprises providing an image to the first trained ML model, and wherein processing the input data item comprises extracting features from the image.
10 . The apparatus as claimed in claim 9 , wherein:
the apparatus is a controllable autonomous or semi-autonomous apparatus for performing a task in an environment comprising at least two objects,
the image being captured is an image of the environment, and
the at least one processor uses the corrected processing result to control the controllable autonomous or semi-autonomous apparatus in the environment.
11 . The apparatus as claimed in claim 10 , wherein the controllable apparatus comprises at least one gripper, and wherein the at least one processor controls the at least one gripper to interact with an object in the environment based on the corrected processing result.
12 . The apparatus as claimed in claim 10 , further comprising a system for moving the apparatus through the environment, wherein the at least one processor controls the system based on the corrected processing result.
13 . The apparatus as claimed in claim 9 , wherein:
the apparatus is a wearable augmented reality device for controlling virtual objects blended into a real-world environment comprising at least one real object,
the image being captured is an image of the environment, and
the at least one processor uses the corrected processing result to control virtual objects correctly with respect to the at least one real object.
14 . A non-transitory computer-readable storage medium including a program executes a controlling method of a processor, the method comprising:
receiving, by a communication module, an input data item to be provided to the first trained machine learning, ML, model;
providing the input data item to the first trained machine learning, ML, model, processing the input data item using the first ML model, and outputting, from the first ML model, a processing result;
providing, through the communication module, the processing result to a second trained machine learning, ML, model trained to detect an error in the processing result, and outputting, from the second ML model, information on whether there is at least one error in the processing result;
generating a masked solution by nullifying components of the processing result identified as erroneous by the second ML model;
when the output of the second ML model indicates there is at least one error in the processing result, providing, through the communication module, the masked solution to into-a reasoning module, correcting, using the reasoning module, each nullified component of the masked solution, and outputting, from the reasoning module, a corrected processing result for the input data item; and
jointly training the first ML model and the second ML model using the corrected processing result for the input data item.
15 . A non-transitory computer-readable storage medium as claimed in claim 14 , wherein outputting a processing result from the first trained ML model comprises outputting a first vector, and wherein outputting information from the second trained ML model on whether there is at least one error in the processing result comprises generating a second vector that indicates, for each component of the first vector, whether an error is detected in that component.
16 . A non-transitory computer-readable storage medium as claimed in claim 15 , wherein generating a masked solution comprises:
generating a third vector, when the second vector generated by the second ML model indicates there is at least one error in the processing result, by nullifying each component of the first vector when the second vector indicates an error in that component of the first vector.
17 . A non-transitory computer-readable storage medium as claimed in claim 16 , wherein providing the masked solution to a reasoning module comprises providing the third vector to the reasoning module; and
wherein correcting each nullified component of the masked solution comprises outputting a fourth vector, from the reasoning module, comprising corrected values for each nullified component of the first vector.
18 . A non-transitory computer-readable storage medium as claimed in claim 16 , wherein correcting each nullified component of the masked solution comprises determining a correction to the detected error using at least one predetermined constraint specific to a domain to which the input data item belongs.
19 . A non-transitory computer-readable storage medium as claimed in claim 16 , wherein providing the input data item comprises providing an image to the first trained ML model, and wherein processing the input data item comprises:
extracting features from the image; and
outputting a processing result using the extracted features.
20 . A non-transitory computer-readable storage medium as claimed in claim 19 , wherein the image is an image of a scene depicting at least two objects, and outputting a processing result using the extracted features comprises outputting a scene graph showing a relationship between the at least two objects in the scene.