Package: mlmodelwatermarking
Protect your machine learning models easily and securely with watermarking :key:The concept of digital watermarking has been known for 30 years, mainly for image and audio contents. The goal is to insert a unique, hidden and non-removable signal in the original content, to be used as an identifier. If a thief steals a content, the original owner can still prove his/her ownership. ML Model Watermarking offers basic primitives for researchers and machine learning enthusiasts to watermark their models, without advanced knowledge of underlying concepts.:book: Watermark models on various tasks, such asimage classificationorsentiment analysis, with a compatibility with the main Machine Learning frameworks likeScikit-learn,Pytorchor theHuggingFace library.:triangular_flag_on_post: Detect if one of your models has been used without consent.:chart_with_upwards_trend: Integrate watermark in your pipeline, with a negligible accuracy loss.InstallationSimply run:>>>pipinstall.How to use itML Model Watermarking acts as a wrapper for your model, provoding a range of techniques for watermarking your model as well as ownership detection function. After the watermarking phase, you can retrieve your model and save the ownership information.>>>frommlmodelwatermarking.markfaceimportTrainerWM>>>trainer=TrainerWM(model=your_model)>>>ownership=trainer.watermark()>>>watermarked_model=trainer.get_model()Later, it is possible verify if a given model has been stolen based on the ownership information>>>frommlmodelwatermarking.marktorchimportTrainerWM>>>frommlmodelwatermarking.verificationimportverify>>>trainer=TrainerWM(model=suspect_model,ownership=ownership)>>>trainer.verify(){'is_stolen':True,'score':0.88,'threshold':0.66}ReferencesThe library implements several ideas presented in academic papers:TechniqueScikit-learnPyTorchHuggingFaceAdi et al.:heavy_check_mark:Zhang et al.:heavy_check_mark::heavy_check_mark:Gu et al.:heavy_check_mark:Merrer et al.:heavy_check_mark:Yang et al.:heavy_check_mark:Szyller et al.:heavy_check_mark::heavy_check_mark:Lounici et al.:heavy_check_mark::heavy_check_mark::heavy_check_mark:Turning Your Weakness Into a Strength: Watermarking Deep Neural Networks by Backdooringby Adi et al.Protecting Intellectual Property of Deep Neural Networks with Watermarkingby Zhang et al.BadNets: Evaluating Backdooring Attacks on Deep Neural Networksby Gu et al.Adversarial frontier stitching for remote neural network watermarkingby Merrer et al.Rethinking Stealthiness of Backdoor Attack against NLP Modelsby Yang et al.DAWN: Dynamic Adversarial Watermarking of Neural Networksby Szyller et al.Yes We can: Watermarking Machine Learning Models beyond Classificationby Lounici et al.ContributingWe invite your participation to the project through issues and pull requests. Please refer to theContributing guidelinesfor how to contribute.How to obtain supportYou can open anissue.LicensingCopyright 2020-21 SAP SE or an SAP affiliate company and ml-model-watermarking contributors. Please see ourLICENSEfor copyright and license information. Detailed information including third-party components and their licensing/copyright information isavailable via the REUSE tool.