Browse Source

Fix file permissions and device support options

tags/v1.1.0
liuluobin 4 years ago
parent
commit
5ecde7db2f
2 changed files with 2 additions and 5 deletions
  1. +0
    -0
      examples/model_security/model_attacks/cv/faster_rcnn/coco_attack_pgd.py
  2. +2
    -5
      examples/model_security/model_attacks/cv/yolov3_darknet53/coco_attack_deepfool.py

+ 0
- 0
examples/model_security/model_attacks/cv/faster_rcnn/coco_attack_pgd.py View File


+ 2
- 5
examples/model_security/model_attacks/cv/yolov3_darknet53/coco_attack_deepfool.py View File

@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# ============================================================================
"""generate adversarial example for yolov3_darknet53 by DeepFool"""
"""Generate adversarial example for yolov3_darknet53 by DeepFool"""
import os
import argparse
import datetime
@@ -39,9 +39,6 @@ def parse_args():
parser = argparse.ArgumentParser('mindspore coco testing')

# device related
parser.add_argument('--device_target', type=str, default='Ascend', choices=['Ascend', 'GPU'],
help='device where the code will be implemented. (Default: Ascend)')

parser.add_argument('--data_dir', type=str, default='', help='train data dir')
parser.add_argument('--pretrained', default='', type=str, help='model_path, local pretrained model to load')
parser.add_argument('--samples_num', default=1, type=int, help='Number of sample to be generated.')
@@ -83,7 +80,7 @@ def test():
args = parse_args()

devid = int(os.getenv('DEVICE_ID')) if os.getenv('DEVICE_ID') else 0
context.set_context(mode=context.GRAPH_MODE, device_target=args.device_target, save_graphs=True, device_id=devid)
context.set_context(mode=context.GRAPH_MODE, device_target='Ascend', save_graphs=True, device_id=devid)

# logger
args.outputs_dir = os.path.join(args.log_path,


Loading…
Cancel
Save