File tree Expand file tree Collapse file tree 1 file changed +17
-6
lines changed Expand file tree Collapse file tree 1 file changed +17
-6
lines changed Original file line number Diff line number Diff line change 2
2
3
3
This demonstrates pruning a VGG16 based classifier that classifies a small dog/cat dataset.
4
4
5
+
5
6
This was able to reduce the CPU runtime by x3 and the model size by x4.
7
+
6
8
For more details you can read the [ blog post] ( https://jacobgil.github.io/deeplearning/pruning-deep-learning ) .
7
9
8
10
At each pruning step 512 filters are removed from the network.
@@ -12,14 +14,21 @@ Usage
12
14
-----
13
15
14
16
This repository uses the PyTorch ImageFolder loader, so it assumes that the images are in a different directory for each category.
15
- `Train
17
+
18
+ Train
19
+
16
20
......... dogs
21
+
17
22
......... cats
18
- `
19
- `Test
23
+
24
+
25
+ Test
26
+
27
+
20
28
......... dogs
29
+
21
30
......... cats
22
- `
31
+
23
32
24
33
The images were taken from [ here] ( https://www.kaggle.com/c/dogs-vs-cats ) but you should try training this on your own data and see if it works!
25
34
36
45
In principle this can be done in a single pass.
37
46
38
47
{% highlight python %}
39
- for layer_index, filter_index in prune_targets:
40
- model = prune_vgg16_conv_layer(model, layer_index, filter_index)
48
+
49
+ for layer_index, filter_index in prune_targets:
50
+ model = prune_vgg16_conv_layer(model, layer_index, filter_index)
51
+
41
52
{% endhighlight %}
42
53
43
54
- Change prune_vgg16_conv_layer to support additional architectures.
You can’t perform that action at this time.
0 commit comments