The invention discloses a federal learning poisoning detection method and device based on feature confrontation, and the method comprises the steps: dividing all clients of each round of parameter training into benign clients and defense clients, and configuring a defense patch
data set for the defense clients; in each round of training, enabling the benign
client to optimize the benign model by using the local
data set, enabling the defense
client to optimize the defense model by using the defense patch
data set and the local data, and enabling the
server to aggregate all the benign models and the defense models to obtain a
federated learning model; after multiple rounds of training are finished, using the
federated learning model of the last round for detecting a poisoning sample, and during detection, according to a prediction result of a target
label of a
test sample in the
federated learning model, and judging whether the
test sample is poisoned or not by judging whether the prediction result of the defense target
label in the federated learning model meets the
label mapping relation after the optimal defense patch data is added into the
test sample, namely realizing federated learning poisoning detection.