Xilinx / ml-suite

Getting Started with Xilinx ML Suite
https://aws.amazon.com/marketplace/pp/B077FM2JNS
Other
335 stars 152 forks source link

Run Run the Quantizer errir #100

Open rokmc612 opened 5 years ago

rokmc612 commented 5 years ago

I try to thr Tensorflow custom model base on ML-suite v1.5 and i used by jupyter's image_classification_tensorflow env.

but, i have an error for the step #3 Run the Quantizer flow.

would you pls advice to me and refer to the as below log file

print("Running with protoBuffer: %s" % protoBuffer) print("Running with quantInfo: %s" % quantInfo) print("Running with inputNode: %s" % inputNode) print("Running with outputNode: %s" % outputNode) print("Running with inputShape: %s" % inputShape) print("Running with means: %s" % means

Running with protoBuffer: /home/mluser/share/SRCNN-Tensorflow-master/checkpoint/srcnn_21/SRCNN.model/graph.pb Running with quantInfo: /opt/models/tensorflow/quantization_fix_info.txt Running with inputNode: images Running with outputNode: Mean Running with inputShape: 33,33 Running with means: 104,107,123

!decent_q inspect --input_frozen_graph $protoBuffer

Op types used: 30 Const, 21 Identity, 12 Assign, 10 NoOp, 9 Reshape, 8 Sum, 7 Shape, 6 VariableV2, 6 Add, 6 ApplyGradientDescent, 5 Mul, 4 BroadcastGradientArgs, 3 Conv2DBackpropInput, 3 ShapeN, 3 Conv2D, 3 Conv2DBackpropFilter, 3 RandomStandardNormal, 2 Relu, 2 ReluGrad, 2 Prod, 2 Placeholder, 1 RealDiv, 1 Fill, 1 Neg, 1 RestoreV2, 1 SaveV2, 1 Cast, 1 Mean, 1 Square, 1 Sub, 1 Maximum, 1 Tile, 1 FloorDiv

Found 2 possible inputs: (name=images, type=float(1), shape=[?,33,33,1]) (name=labels, type=float(1), shape=[?,21,21,1]) Found 4 possible outputs: (name=Mean, op=Mean) (name=save/control_dependency, op=Identity) (name=gradients/sub_grad/tuple/control_dependency, op=Identity) (name=gradients/Conv2D_grad/tuple/control_dependency, op=Identity)

!decent_q quantize \ --input_frozen_graph $protoBuffer \ --input_nodes $inputNode \ --output_nodes $outputNode \ --input_shapes ?,$inputShape,3 \ --output_dir $MODELDIR \ --input_fn util.input_fn \ --method 1 \ --calib_iter 100

INFO: Checking Float Graph... Traceback (most recent call last): File "/usr/local/bin/decent_q", line 10, in sys.exit(run_main()) File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/decent_q/python/decent_q.py", line 540, in run_main app.run(main=my_main, argv=[sys.argv[0]] + unparsed) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 125, in run _sys.exit(main(argv)) File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/decent_q/python/decent_q.py", line 539, in my_main = lambda unused_args: main(unused_args, FLAGS) File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/decent_q/python/decent_q.py", line 335, in main quantize_frozen(input_graph_def, input_fn, q_config, s_config, flags.skip_check) File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/decent_q/python/decent_q.py", line 222, in quantize_frozen check_float_graph(input_graph_def, input_fn, q_config, s_config) File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/decent_q/python/decent_q.py", line 144, in check_float_graph feed_dict = gen_feed_dict(input_tensors, inputs) File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/decent_q/python/utils.py", line 121, in gen_feed_dict "len(inputs) != len(input_nodes), please check your input_fn.") ValueError: len(inputs) != len(input_nodes), please check your input_fn.

katherineyun commented 5 years ago

you will need to modify utils.py before quantization step. Make sure the input nodes and sizes in utils.py match those of your custom model.