affinelayer / pix2pix-tensorflow

Tensorflow port of Image-to-Image Translation with Conditional Adversarial Nets https://phillipi.github.io/pix2pix/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Windows Defender breaks export-checkpoint.py

sam598 opened this issue · comments

Depending on how many epochs the model has been trained, Windows Defender thinks the temporary file "generator_encoder_4_batch_normalization_gamma" is a threat and deletes it while the model is being exported, which crashes the export.

I was able to get around it by creating an exception for the pix2pix folder, and dumping the checkpoints locally instead of into a temporary directory.

Its very strange, especially since the normalization gamma weights are only 2kb.

You're right. After hours of getting this error, disabling windows defender while I run the script did it for me.

@sam598 was your error like mine? #171
if so, could you tell me how to fix this, disabling Windows Defender doesnt seem to work and I'm not sure how to change the code to dump it locally instead of in the temp folder. (which doesn't seem to exist, so I suppose its getting deleted)

edit: fixed it by changing

checkpoint_file = os.path.join(args.checkpoint, model_path)
    with tempfile.TemporaryDirectory() as tmp_dir:
        cmd = ["python", "-u", os.path.join(SCRIPT_DIR, "dump_checkpoints/dump_checkpoint_vars.py"), "--model_type", "tensorflow", "--output_dir", tmp_dir, "--checkpoint_file", checkpoint_file]
        sp.check_call(cmd)

to

checkpoint_file = os.path.join(args.checkpoint, model_path)
    with tempfile.TemporaryDirectory() as tmp_dir:
        tmp_dir = "D:/AI/pix2pix-tensorflow/server/tools/tmp/" # change this to another temp dir
        cmd = ["python", "-u", os.path.join(SCRIPT_DIR, "dump_checkpoints/dump_checkpoint_vars.py"), "--model_type", "tensorflow", "--output_dir", tmp_dir, "--checkpoint_file", checkpoint_file]
        sp.check_call(cmd)

and adding this folder to the Windows Defender Exceptions.

Virustotal link: https://www.virustotal.com/gui/file/40dbbc12ef8f3e2fd7a8a8ae6f390593b8d6f93304d7e65b82553af652b30b10/detection