InjectTFParallel is a fault injection software for simulating hardware faults to evaluate the reliability of non-sequential deep learning models (i.e Deep learning models with branches).
For example: [ResNet50], [InceptionV3], [MobileNetV2]
- Description
- Getting Started
- Results
- Implementation Details
- References
- License
- Author Info
- Acknowledgements
InjectTFParallel software provides us fault injection functionality to test the resilience of deep learning models against hardware faults. InjectTF2 is a fault injection software for sequential models. InjectTFParallel mainly focuses on injecting fault into non-sequential models (i.e) model containing layers with more than one input or one output. In InjectTFParallel, fault injection into a model is done by creating a duplicate copy of the model and inserting fault injection custom layers. Two types of faults namely random bit fault and specific bit fault can be injected using InjectTFParallel. Each of these faults have unique custom layer implementation. Based on the chosen fault type, appropriate custom layer is inserted into duplicate copy of the model(also called as fault model). Fault model is then evaluated on the test dataset.
Keract library is used to visualize intermediate layer outputs in order to understand the behaviour of the model on fault injection.
- Python (v3.x.x)
- Clone the repository using following command.
$ git clone https://github.com/Abirami-mygithub/InjectTFParallel.git
- Create a virtual environment inside the cloned repository folder (InjectTFParallel).
$ python3 -m venv .venv
- Activate the created virtual environment
$ source .venv/bin/activate
- Install the dependencies from requirements.txt
$ pip install -r requirements.txt --no-cache-dir
- Import fault injector component
from injecttf.fault_injector import Fault_Injector
- Instantiate fault injector component
fi_obj = Fault_Injector()
- Call inject_fault() from fault injector component using the instantiated object.
fi_obj.inject_fault()
example.py is created to show the usage of InjectTFParallel fault injector.
InjectTFParallel software architecture mainly comprises of configuration manager, model trainer, fault injector, model creator, datasets, custom layer, evaluation and visualization components. Each of these components have individual responsibility and interact with each other to provide the fault injection functionality.
-
Configuration Manager: It is responsible for reading from the config file containing fault injection specification and provide the fault injection configuration on request. It provides the config data in python dictionary.
-
Model Creator: It provides the model architecture based on the user's request .
-
Dataset: It provides preprocessed mnist and gtsrb dataset
-
Model Trainer: It fetches the model from model creator and dataset, trains the model if not saved weights are available. It provides model and the weights .
-
Custom Layer: Fault injection is done through creating custom layers. Two different custom layers namely Fault_Injector_Random_Bit and Fault_Injector_Specific_Bit is created. Each has its own functionality.
-
Fault Injector: It is responsible for creating a duplicate copy of the model for which fault is to be injected and based on the fault injection specification from config file, inserts appropriate fault injection custom layer into the duplicate copy of the model. Thereby a new fault model is created with fault injection custom layer. This fault model is compiled and evaluated.
Probability | Accuracy | Loss |
---|---|---|
100% | 0.1009 | 2.3602 |
90% | 0.2026 | 2.2574 |
80% | 0.0958 | 2.3653 |
70% | 0.9598 | 1.5011 |
50% | 0.9235 | 1.5678 |
40% | 0.9630 | 1.4982 |
- Error while loading the weights from .h5 file
Downgrade h5py to < 3.0.0 by following command:
$ pip install 'h5py<3.0.0'
[2] Szegedy, Christian, et al. "Rethinking the inception architecture for computer vision." Proceedings of the IEEE conference on computer vision and pattern recognition. 2016.
[3] Sandler, Mark, et al. "Mobilenetv2: Inverted residuals and linear bottlenecks." Proceedings of the IEEE conference on computer vision and pattern recognition. 2018.
MIT License
Copyright (c) 2021 Abirami Ravi
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
Special thanks to Saiteja Malyala