A computer-implemented method for using an image classifier, particularly a binary classifier, for classifying sensor signals of an optical sensor for providing an actuator control signal for controlling an actuator, in which said actuator controls an at least partially autonomous robot and/or a manufacturing machine and/or an access control system, wherein said classifier is trained for classifying input signals (x i) to optimize performance according to a non-decomposable metric that measures an alignment between classifications (y i) corresponding to input signals (x i) of a set of training data and corresponding predicted classifications (y i) of said input signals obtained from said classifier, the training comprising the steps of: - providing weighting factors ( a j, b j, f j, g j) that characterize how said non-decomposable metric depends on a plurality of terms (RP, TN, PP, AP, AN) from a confusion matrix of said classifications ( y i) and said predicted classifications ( ŷ i); - training said classifier depending on said provided weighting factors ( a j, b j, fj, g j), wherein the optimization is carried out as an adversarial prediction method, wherein the method for using the image classifier comprises the steps of: - receiving a sensor signal comprising data from an optical sensor, - determining an input signal (x) which depends on said sensor signal, and - feeding said input signal (x) into said classifier to obtain an output signal (y) that characterizes a classification of said input signal (x), - determining said actuator control signal depending on said output signal (y). in which said actuator controls an at least partially autonomous robot and/or a manufacturing machine and/or an access control system, wherein said classifier is trained for classifying input signals (x i) to optimize performance according to a non-decomposable metric that measures an alignment between classifications (y i) corresponding to input signals (x i) of a set of training data and corresponding predicted classifications (y i) of said input signals obtained from said classifier, the training comprising the steps of: - providing weighting factors ( a j, b j, f j, g j) that characterize how said non-decomposable metric depends on a plurality of terms (RP, TN, PP, AP, AN) from a confusion matrix of said classifications ( y i) and said predicted classifications ( ŷ i); - training said classifier depending on said provided weighting factors ( a j, b j, fj, g j), - providing weighting factors ( a j, b j, f j, g j) that characterize how said non-decomposable metric depends on a plurality of terms (RP, TN, PP, AP, AN) from a confusion matrix of said classifications ( y i) and said predicted classifications ( ŷ i); - training said classifier depending on said provided weighting factors ( a j, b j, fj, g j), wherein the optimization is carried out as an adversarial prediction method, wherein the method for using the image classifier comprises the steps of: - receiving a sensor signal comprising data from an optical sensor, - determining an input signal (x) which depends on said sensor signal, and - feeding said input signal (x) into said classifier to obtain an output signal (y) that characterizes a classification of said input signal (x), - determining said actuator control signal depending on said output signal (y). - receiving a sensor signal comprising data from an optical sensor, - determining an input signal (x) which depends on said sensor signal, and - feeding said input signal (x) into said classifier to obtain an output signal (y) that characterizes a classification of said input signal (x), - determining said actuator control signal depending on said output signal (y).