PocketFlow
PocketFlow copied to clipboard
Only last layer of MobileNetv2 is treated maskable by WeightSparse learner
Describe the bug A clear and concise description of what the bug is.
To Reproduce The command to reproduce the issue
./scripts/run_local.sh nets/mobilenet_at_ilsvrc12_run.py --mobilenet_version 2 --ws_prune_ratio_prtl uniform --ws_prune_ratio 0.75 --learner weight-sparse --save_path models/model.ckpt --ws_iter_ratio_beg 0.0 --lrn_rate_init 0.01
Expected behavior
We expect all of Conv2d and FC layers are in model's maskable_vars, but the running log shows only the last fc layer model/MobilenetV2/Logits/Conv2d_1c_1x1/weights is maskable. We debugged into it and found the issues in get_maskable_vars defined in weight_sparsification/utils.py. It uses the names to decide which variable to be maskable or not. It works for most of models, but in mobilenet_v2. The variables are named something like model/MobilenetV2/expanded_conv_9/project/weights and model/MobilenetV2/expanded_conv_11/depthwise/depthwise_weights/. As a result, most of variables are ignored.
Additional context
INFO:tensorflow:helpshort: False
2019-02-19 14:48:25.879964: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2019-02-19 14:48:26.799096: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1405] Found device 0 with properties:
name: GeForce GTX 1080 Ti major: 6 minor: 1 memoryClockRate(GHz): 1.62
pciBusID: 0000:02:00.0
totalMemory: 10.92GiB freeMemory: 10.76GiB
2019-02-19 14:48:26.799162: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1484] Adding visible gpu devices: 0
2019-02-19 14:48:27.120372: I tensorflow/core/common_runtime/gpu/gpu_device.cc:965] Device interconnect StreamExecutor with strength 1 edge matrix:
2019-02-19 14:48:27.120406: I tensorflow/core/common_runtime/gpu/gpu_device.cc:971] 0
2019-02-19 14:48:27.120413: I tensorflow/core/common_runtime/gpu/gpu_device.cc:984] 0: N
2019-02-19 14:48:27.120696: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1097] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 10405 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1080 Ti, pci bus id: 0000:02:00.0, compute capability: 6.1)
INFO:tensorflow:model/MobilenetV2/Logits/Conv2d_1c_1x1/weights:0: 0.750000