MCPcopy Create free account
hub / github.com/tensorflow/tfjs-examples / parseArguments

Function parseArguments

visualize-convnet/main.js:34–73  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

32const utils = require('./utils');
33
34function parseArguments() {
35 const parser =
36 new argparse.ArgumentParser({description: 'Visualize convnet'});
37 parser.addArgument('modelJsonUrl', {
38 type: 'string',
39 help: 'URL to model JSON. Can be a file://, http://, or https:// URL'
40 });
41 parser.addArgument('convLayerNames', {
42 type: 'string',
43 help: 'Names of the conv2d layers to visualize, separated by commas ' +
44 'e.g., (block1_conv1,block2_conv1,block3_conv1,block4_conv1)'
45 });
46 parser.addArgument('--inputImage', {
47 type: 'string',
48 defaultValue: '',
49 help: 'Path to the input image. If specified, will compute the internal' +
50 'activations of the specified convolutional layers. If not specified, ' +
51 'will compute the maximally-activating input images using gradient ascent.'
52 });
53 parser.addArgument('--outputDir', {
54 type: 'string',
55 defaultValue: 'dist/filters',
56 help: 'Output directory to which the image files and the manifest will ' +
57 'be written'
58 });
59 parser.addArgument('--filters', {
60 type: 'int',
61 defaultValue: 64,
62 help: 'Number of filters to visualize for each conv2d layer'
63 });
64 parser.addArgument('--iterations', {
65 type: 'int',
66 defaultValue: 80,
67 help: 'Number of iterations to use for gradient ascent'
68 });
69 parser.addArgument(
70 '--gpu',
71 {action: 'storeTrue', help: 'Use tfjs-node-gpu (required CUDA GPU).'});
72 return parser.parseArgs();
73}
74
75/**
76 * Calcuate and save the maximally-activating input images for a covn2d layer.

Callers 1

runFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected