Skip to content

yqtianust/DFlare

Repository files navigation

README of DFlare

This repo is the implementation of DFlare. DFlare is the tool proposed in our paper Finding Deviated Behaviors of the Compressed DNN Models for Image Classifications, which is accepted by ACM TOSEM in 2023.

Instructions

The main logic of DFlare is in test_gen_main.py. To run the code, please run the wrapper: gen_wrapper_tflite.py

Here is an example:

python3 gen_wrapper_tflite.py --dataset mnist --arch lenet1 --maxit 10000000 --seed 0 --num 500 --cps_type quan --output_dir ./results

where model can be one of 'lenet1', 'lenet5', 'resnet'. If model is resnet, then it should be --dataset cifar.

seed can be 0,1,2,3,4.

Dataset and Models.

Datasets

seed_inputs.p stores the seed inputs used by us.

The models from DiffChaser

./diffchaser_models list the models from diffchaser.

The models prepared by us

Pelase downloadn it from here and follow the instructions in the readme.

ImageNet models

Models are available at PyTorch

DeepSpeech models

Moldes are available at DeepSpeech.

Please note that the compressed model and the original models cannot be executed in the same enviroment. The compressed models need the python package deepspeech-tflite'' while the original models need the package deepspeech'' or ``deepspeech-gpu''. More details are available at here.

Using other models

To apply it on other models, please revise the `gen_wrapper_tflite.py'

Environment.

DFlare majorly requires the following package.

pyflann-py3==0.1.0
opencv-python-headless==4.5.3.56
numpy

However, the tflite model requires much more. Here we give the list of package in our environment.
A full list package for reference is in tflite_requirement.txt.

System Package

pip: 21.2.4
cuda: 10.1

python package

Keras==2.4.3
tensorflow==2.2.0

Questions

Feel free to leave a question using issue report, or contact me via yongqiang.tian - at - uwaterloo.ca

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages