Skip to content
KitploitKITPLOIT
उपकरणब्लॉग
जमा करें
उपकरणब्लॉग
जमा करें

हैकिंग, पेनटेस्ट और साइबर सुरक्षा उपकरण आपके सुरक्षा शस्त्रागार के लिए!

Kitploit हैकिंग, साइबर सुरक्षा और पेंटेस्टिंग टूल्स की एक निर्देशिका है। कमजोरियों को खोजने, सिस्टम का विश्लेषण करने, परीक्षण को स्वचालित करने और अपनी सुरक्षा को मजबूत करने के लिए नवीनतम प्रोजेक्ट अपडेट खोजें।

··फ़ीड·संपर्क·गोपनीयता·© 2026 Kitploit

टूल निर्देशिका

श्रेणियाँ

सभी श्रेणियाँ देखें
Loading categories
robustness — न्यूरल नेटवर्क को प्रशिक्षित करें, मूल्यांकन करें और अन्वेषण करें, जिसमें अंतर्निहित प्रतिकूल मजबूती उपकरण शामिल हैं, जिनमें PGD हमले, प्रतिकूल प्रशिक्षण, और विज़न अनुसंधान के लिए मजबूत पूर्व-प्रशिक्षित मॉडल शामिल हैं। | Kitploit
उपकरण/GitHubGitHub/madrylab/robustness
रक्षात्मक उपकरणमशीन लर्निंगAI सुरक्षाप्रतिकूल हमला
GitHubmadrylab/robustness

robustness

न्यूरल नेटवर्क को प्रशिक्षित करें, मूल्यांकन करें और अन्वेषण करें, जिसमें अंतर्निहित प्रतिकूल मजबूती उपकरण शामिल हैं, जिनमें PGD हमले, प्रतिकूल प्रशिक्षण, और विज़न अनुसंधान के लिए मजबूत पूर्व-प्रशिक्षित मॉडल शामिल हैं।

रिपॉजिटरी देखें
9461792 साल पहलेKitploit द्वारा समीक्षित

सबसे लोकप्रिय

सभी देखें →

हमारे समुदाय द्वारा सबसे अधिक उपयोग किए जाने वाले उपकरण खोजें।

सभी उपकरण खोजें

हमारे उपकरणों का संग्रह ब्राउज़ करें

सभी उपकरण देखें →
साझा करें

robustness package

pip के माध्यम से इंस्टॉल करें: pip install robustness

दस्तावेज़ पढ़ें: https://robustness.readthedocs.io/en/latest/index.html

robustness एक पैकेज है जिसे हमने (MadryLab <http://madry-lab.ml>_) के छात्रों ने तंत्रिका नेटवर्क को प्रशिक्षित करने, मूल्यांकन करने और एक्सप्लोर करने को लचीला और आसान बनाने के लिए बनाया है। हम इसे अपनी लगभग सभी परियोजनाओं में उपयोग करते हैं (चाहे उनमें adversarial प्रशिक्षण शामिल हो या नहीं!) और यह हमारे आगामी कई कोड रिलीज़ में एक निर्भरता (dependency) होगा। लाइब्रेरी का उपयोग करने वाली कुछ परियोजनाएँ निम्नलिखित हैं:

  • "Learning Perceptually-Aligned Representations via Adversarial Robustness" के लिए कोड <https://github.com/MadryLab/robust_representations>_ (https://arxiv.org/abs/1906.00945)
  • "Image Synthesis with a Single (Robust) Classifier" के लिए कोड <https://github.com/MadryLab/robustness_applications>_ (https://arxiv.org/abs/1906.09453)
  • "Do Adversarially Robust ImageNet Models Transfer Better?" के लिए कोड <https://github.com/microsoft/robust-models-transfer>_ (https://arxiv.org/abs/2007.08489)
  • "BREEDS: Benchmarks for Subpopulation Shift" के लिए कोड <https://github.com/MadryLab/BREEDS-Benchmarks>_ (https://arxiv.org/abs/2008.04859)
  • "Certified Patch Robustness via Smoothed Vision Transformers." के लिए कोड <https://github.com/MadryLab/smoothed-vit>_ (https://arxiv.org/abs/2110.07719)
  • "Unadversarial Examples: Designing Objects for Robust Vision." के लिए कोड <https://github.com/microsoft/unadversarial>_ (https://arxiv.org/abs/2012.12235)

हम वॉकथ्रू के एक सेट और हमारे API संदर्भ में लाइब्रेरी का उपयोग करने का तरीका प्रदर्शित करते हैं। लाइब्रेरी द्वारा प्रदान की जाने वाली कार्यक्षमता में शामिल हैं:

  • विभिन्न डेटासेट/आर्किटेक्चर के लिए मानक और robust मॉडलों को एक CLI इंटरफ़ेस <https://robustness.readthedocs.io/en/latest/example_usage/cli_usage.html>_ का उपयोग करके प्रशिक्षित और मूल्यांकन करना। लाइब्रेरी कस्टम डेटासेट <https://robustness.readthedocs.io/en/latest/example_usage/training_lib_part_2.html#training-on-custom-datasets>_ और मॉडल आर्किटेक्चर <https://robustness.readthedocs.io/en/latest/example_usage/training_lib_part_2.html#training-with-custom-architectures>_ जोड़ने के लिए भी समर्थन प्रदान करती है।

.. code-block:: bash

python -m robustness.main --dataset cifar --data /path/to/cifar
--adv-train 0 --arch resnet18 --out-dir /logs/checkpoints/dir/

  • robust (या मानक) मॉडलों का उपयोग करके इनपुट मैनिपुलेशन <https://robustness.readthedocs.io/en/latest/example_usage/input_space_manipulation.html>_ करना---इसमें adversarial उदाहरण बनाना, representations को उलटना, feature visualization आदि शामिल हैं। लाइब्रेरी विभिन्न प्रकार के ऑप्टिमाइज़ेशन विकल्प प्रदान करती है (जैसे वास्तविक/अनुमानित ग्रेडिएंट्स के बीच चयन, Fourier/pixel basis, custom loss functions आदि), और इसे आसानी से एक्सटेंड किया जा सकता है।

.. code-block:: python

import torch as ch from robustness.datasets import CIFAR from robustness.model_utils import make_and_restore_model

ds = CIFAR('/path/to/cifar') model, _ = make_and_restore_model(arch='resnet50', dataset=ds, resume_path='/path/to/model', state_dict_path='model') model.eval() attack_kwargs = { 'constraint': 'inf', # L-inf PGD 'eps': 0.05, # Epsilon constraint (L-inf norm) 'step_size': 0.01, # Learning rate for PGD 'iterations': 100, # Number of PGD steps 'targeted': True # Targeted attack 'custom_loss': None # Use default cross-entropy loss }

_, test_loader = ds.make_loaders(workers=0, batch_size=10) im, label = next(iter(test_loader)) target_label = (label + ch.randint_like(label, high=9)) % 10 adv_out, adv_im = model(im, target_label, make_adv, **attack_kwargs)

  • robustness को एक पैकेज के रूप में इम्पोर्ट करना, जो custom loss functions, logging, data loading, और बहुत कुछ के समर्थन के साथ तंत्रिका नेटवर्क के आसान प्रशिक्षण की अनुमति देता है! एक अच्छा परिचय हमारे दो-भाग वाले वॉकथ्रू (भाग 1 <https://robustness.readthedocs.io/en/latest/example_usage/training_lib_part_1.html>, भाग 2 <https://robustness.readthedocs.io/en/latest/example_usage/training_lib_part_2.html>) में पाया जा सकता है।

.. code-block:: python

from robustness import model_utils, datasets, train, defaults from robustness.datasets import CIFAR

We use cox (http://github.com/MadryLab/cox) to log, store and analyze

results. Read more at https//cox.readthedocs.io.

from cox.utils import Parameters import cox.store

Hard-coded dataset, architecture, batch size, workers

ds = CIFAR('/path/to/cifar') m, _ = model_utils.make_and_restore_model(arch='resnet50', dataset=ds) train_loader, val_loader = ds.make_loaders(batch_size=128, workers=8)

Create a cox store for logging

out_store = cox.store.Store(OUT_DIR)

Hard-coded base parameters

train_kwargs = { 'out_dir': "train_out", 'adv_train': 1, 'constraint': '2', 'eps': 0.5, 'attack_lr': 1.5, 'attack_steps': 20 } train_args = Parameters(train_kwargs)

Fill whatever parameters are missing from the defaults

train_args = defaults.check_and_fill_args(train_args, defaults.TRAINING_ARGS, CIFAR) train_args = defaults.check_and_fill_args(train_args, defaults.PGD_ARGS, CIFAR)

Train a model

train.train_model(train_args, m, (train_loader, val_loader), store=out_store)

नोट: robustness के लिए CUDA समर्थन के साथ PyTorch इंस्टॉल होना आवश्यक है।

Pretrained models

प्रशिक्षण कोड के साथ, हम विभिन्न डेटासेट, norms और ε-train मानों के लिए कई प्रीट्रेंड मॉडल भी जारी करते हैं। जैसे-जैसे हम अधिक या बेहतर मॉडल जारी करेंगे, यह सूची अपडेट की जाएगी। यदि आप अपने शोध में इन मॉडलों का उपयोग करते हैं, तो कृपया इस लाइब्रेरी को उद्धृत करें (नीचे bibtex प्रविष्टि देखें)।

प्रत्येक (मॉडल, ε-test) संयोजन के लिए हम 2.5 * ε-test / num_steps के step size के साथ 20-step और 100-step PGD का मूल्यांकन करते हैं। चूँकि ये दोनों सटीकताएँ एक-दूसरे के काफी करीब हैं, हम PGD के अधिक steps पर विचार नहीं करते हैं। प्रत्येक ε-test मान के लिए, हम विभिन्न ε-train पर प्राप्त सर्वश्रेष्ठ robust सटीकता को bold में highlight करते हैं।

नोट #1: हमने कोई hyperparameter tuning नहीं की और मानक प्रशिक्षण के समान hyperparameters का उपयोग किया। यह संभावना है कि विभिन्न प्रशिक्षण hyperparameters की खोज करने से ये robust सटीकताएँ कुछ प्रतिशत अंकों तक बढ़ जाएँगी।

नोट #2: नीचे दिए गए pytorch checkpoint (.pt) फ़ाइलें PyTorch और Dill के निम्नलिखित संस्करणों के साथ सहेजी गई थीं:

.. code-block::

torch==1.1.0 dill==0.2.9

CIFAR10 L2-नॉर्म (ResNet50):

  • ε = 0.0 <https://www.dropbox.com/s/yhpp4yws7sgi6lj/cifar_nat.pt?dl=0>_ (मानक प्रशिक्षण)
  • ε = 0.25 <https://www.dropbox.com/s/2qsp7pt6t7uo71w/cifar_l2_0_25.pt?dl=0>_
  • ε = 0.5 <https://www.dropbox.com/s/1zazwjfzee7c8i4/cifar_l2_0_5.pt?dl=0>_
  • ε = 1.0 <https://www.dropbox.com/s/s2x7thisiqxz095/cifar_l2_1_0.pt?dl=0>_

+--------------+----------------+-----------------+---------------------+---------------------+ | CIFAR10 L2-robust accuracy | +--------------+----------------+-----------------+---------------------+---------------------+ | | ε-train | +--------------+----------------+-----------------+---------------------+---------------------+ | ε-test | 0.0 | 0.25 | 0.5 | 1.0 | +==============+================+=================+=====================+=====================+ | 0.0 | 95.25% / - | 92.77% / - | 90.83% / - | 81.62% / - | +--------------+----------------+-----------------+---------------------+---------------------+ | 0.25 | 8.66% / 7.34% | 81.21% / 81.19% | 82.34% / 82.31% | 75.53% / 75.53% | +--------------+----------------+-----------------+---------------------+---------------------+ | 0.5 | 0.28% / 0.14% | 62.30% / 62.13% | 70.17% / 70.11% | 68.63% / 68.61% | +--------------+----------------+-----------------+---------------------+---------------------+ | 1.0 | 0.00% / 0.00% | 21.18% / 20.66% | 40.47% / 40.22% | 52.72% / 52.61% | +--------------+----------------+-----------------+---------------------+---------------------+ | 2.0 | 0.00% / 0.00% | 0.58% / 0.46% | 5.23% / 4.97% | 18.59% / 18.05% | +--------------+----------------+-----------------+---------------------+---------------------+

CIFAR10 Linf-नॉर्म (ResNet50):

  • ε = 0.0 (PyTorch प्रीट्रेंड)
  • ε = 8/255 <https://www.dropbox.com/s/c9qlt1lbdnu9tlo/cifar_linf_8.pt?dl=0>_

+--------------+-----------------+---------------------+ | CIFAR10 Linf-robust accuracy | +--------------+-----------------+---------------------+ | | ε-train | +--------------+-----------------+---------------------+ | ε-test | 0 / 255 | 8 / 255 | +==============+=================+=====================+ | 0 / 255 | 95.25% / - | 87.03% / - | +--------------+-----------------+---------------------+ | 8 / 255 | 0.00% / 0.00% | 53.49% / 53.29% | +--------------+-----------------+---------------------+ | 16 / 255 | 0.00% / 0.00% | 18.13% / 17.62% | +--------------+-----------------+---------------------+

ImageNet L2-नॉर्म (ResNet50):

  • ε = 0.0 (PyTorch प्रीट्रेंड)
  • ε = 3.0 <https://www.dropbox.com/s/knf4uimlqsi1yz8/imagenet_l2_3_0.pt?dl=0>_

+--------------+-----------------+---------------------+ | ImageNet L2-robust accuracy | +--------------+-----------------+---------------------+ | | ε-train | +--------------+-----------------+---------------------+ | ε-test | 0.0 | 3.0 | +==============+=================+=====================+ | 0.0 | 76.13% / - | 57.90% / - | +--------------+-----------------+---------------------+ | 0.5 | 3.35% / 2.98% | 54.42% / 54.42% | +--------------+-----------------+---------------------+ | 1.0 | 0.44% / 0.37% | 50.67% / 50.67% | +--------------+-----------------+---------------------+ | 2.0 | 0.16% / 0.14% | 43.04% / 43.02% | +--------------+-----------------+---------------------+ | 3.0 | 0.13% / 0.12% | 35.16% / 35.09% | +--------------+-----------------+---------------------+

ImageNet Linf-नॉर्म (ResNet50):

  • ε = 0.0 (PyTorch प्रीट्रेंड)
  • ε = 4 / 255 <https://www.dropbox.com/s/axfuary2w1cnyrg/imagenet_linf_4.pt?dl=0>_
  • ε = 8 / 255 <https://www.dropbox.com/s/yxn15a9zklz3s8q/imagenet_linf_8.pt?dl=0>_

+--------------+-----------------+---------------------+---------------------+ | ImageNet Linf-robust accuracy | +--------------+-----------------+---------------------+---------------------+ | | ε-train | +--------------+-----------------+---------------------+---------------------+ | ε-test | 0.0 | 4 / 255 | 8 / 255 | +==============+=================+=====================+=====================+ | 0 / 255 | 76.13% / - | 62.42% / - | 47.91% / - | +--------------+-----------------+---------------------+---------------------+ | 4 / 255 | 0.04% / 0.03% | 33.58% / 33.38% | 33.06% / 33.03% | +--------------+-----------------+---------------------+---------------------+ | 8 / 255 | 0.01% / 0.01% | 13.13% / 12.73% | 19.63% / 19.52% | +--------------+-----------------+---------------------+---------------------+ | 16 / 255 | 0.01% / 0.01% | 1.53% / 1.37% | 5.00% / 4.82% | +--------------+-----------------+---------------------+---------------------+

Citation

यदि आप अपने शोध में इस लाइब्रेरी का उपयोग करते हैं, तो इसे निम्नानुसार उद्धृत करें:

.. code-block:: bibtex

@misc{robustness, title={Robustness (Python Library)}, author={Logan Engstrom and Andrew Ilyas and Hadi Salman and Shibani Santurkar and Dimitris Tsipras}, year={2019}, url={https://github.com/MadryLab/robustness} }

(क्या आपने पैकेज का उपयोग किया है और इसे उपयोगी पाया है? हमें बताएं!).

Maintainers

  • Andrew Ilyas <https://twitter.com/andrew_ilyas>_
  • Logan Engstrom <https://twitter.com/logan_engstrom>_
  • Shibani Santurkar <https://twitter.com/ShibaniSan>_
  • Dimitris Tsipras <https://twitter.com/tsiprasd>_
  • Hadi Salman <https://twitter.com/hadisalmanX>_

Contributors/Commiters '''''''''''''''''''''''

  • देखें यहाँ <https://github.com/MadryLab/robustness/pulse>_
टूल डाउनलोड करें