Open chrhansen opened 8 years ago
@chrhansen I'll do that by the mid January.
@arbox sounds great!
Hi @chrhansen I've just started to collect sources for the tutorial and wonder where should I put them in this repository. Some tutorial.md
under the root? The doc
folder?
@arbox An IRuby notebook might be better suited for this.
@abinashmeher999 but still where? :) Linked throught nbviewer?
The maintainers would be better able to answer where to keep it. For symengine.rb we have a folder named notebooks
under the root folder where they are kept. And also you can open any publicly available notebook on github through nbviewer. There isn't any explicit procedure to link them.
Sorry for the late reply guys.
@abinashmeher999 Thanks for the advice, Iruby is certainly very cool and useful for this.
@arbox I think you could do something very similar and make a notebooks folder and send a Pr. An iruby example like this seems very cool and useful.
Also, I just wanted to mention that the latest version of tensorflow does not support tensorflow rb and that is because tensorflow made many changes to the C API to make it very generic. Currently I am making many changes in my own clone of Tensorflow for a much faster version of Tensorflow.rb compatible with the latest tensorflow C API. I will be sending a pr when the whole thing is done and the tests are passing. But if you have time, please do make the tutorial with by downloading release 0.9.0 and then working with it. I will also update your tutorial if needed. Feel free to email me(arafat.da.khan@gmail.com) if you face any issues.
Thanks
I tried your install.sh on brand new ubuntu 16.04 server, and it works like a charm. Basically, I should have done every thing the same as that script manually on the previous try. Maybe I need some time to figure out exactly what caused the problem.
But I still get a crash when using image_classify.rb with a retrained pb file from the tensorflow tutorials. I think that should be the "not support" problem you mentioned above.
For the error message below, No Operation with the name input exists. No Operation with the name output exists.
I replaced the 'input' with 'Mul' and the 'output' with 'final_result', it worked, but libtensorflow.so still crashed.
BTW, I like the new tensorflow C API, because it is much faster than the previous version.
@Zigngit Thanks for doing this.
Did you download the pb file from this link https://storage.googleapis.com/download.tensorflow.org/models/inception5h.zip
?
I am sorry but the pb file in this link is different from the pb file in the medium tutorial, I just updated the tutorial with the new link.
[https://storage.googleapis.com/download.tensorflow.org/models/inception5h.zip] this one works perfect.
But I would like to use a retrained one. I followed this tutorial and the generate a output_graph.pb , and it cant work with the image_classify.rb https://www.tensorflow.org/tutorials/image_retraining
I also tried retrained model with an older version libtensorflow.so and tensorflow.rb. It also crashed.
root@mt4:~/tensorflow.rb/image# ruby retrain.rb Trying to classify image file: mysore_palace.jpg /usr/local/lib/ruby/gems/2.3.0/gems/tensorflow-0.0.1/lib/tensorflow/session.rb:103: [BUG] Segmentation fault at 0x00000000000017 ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]
-- Control frame information ----------------------------------------------- c:0007 p:---- s:0044 e:000043 CFUNC :tensor_size c:0006 p:0016 s:0040 e:000039 METHOD /usr/local/lib/ruby/gems/2.3.0/gems/tensorflow-0.0.1/lib/tensorflow/session.rb:103 c:0005 p:0010 s:0033 e:000032 BLOCK /usr/local/lib/ruby/gems/2.3.0/gems/tensorflow-0.0.1/lib/tensorflow/session.rb:42 [FINISH] c:0004 p:---- s:0029 e:000028 CFUNC :each c:0003 p:0138 s:0026 e:000025 METHOD /usr/local/lib/ruby/gems/2.3.0/gems/tensorflow-0.0.1/lib/tensorflow/session.rb:41 c:0002 p:0213 s:0013 E:0024d8 EVAL retrain.rb:40 [FINISH] c:0001 p:0000 s:0002 E:000540 (none) [FINISH]
-- Ruby level backtrace information ----------------------------------------
retrain.rb:40:in <main>' /usr/local/lib/ruby/gems/2.3.0/gems/tensorflow-0.0.1/lib/tensorflow/session.rb:41:in
run'
/usr/local/lib/ruby/gems/2.3.0/gems/tensorflow-0.0.1/lib/tensorflow/session.rb:41:in each' /usr/local/lib/ruby/gems/2.3.0/gems/tensorflow-0.0.1/lib/tensorflow/session.rb:42:in
block in run'
/usr/local/lib/ruby/gems/2.3.0/gems/tensorflow-0.0.1/lib/tensorflow/session.rb:103:in convert_value_for_output_array' /usr/local/lib/ruby/gems/2.3.0/gems/tensorflow-0.0.1/lib/tensorflow/session.rb:103:in
tensor_size'
-- Machine register context ------------------------------------------------ RIP: 0x00007f961324c414 RBP: 0x00007ffc0bd934e0 RSP: 0x00007ffc0bd934d0 RAX: 0x0000000000000017 RBX: 0x0000000000000000 RCX: 0x0000000000000000 RDX: 0x00007f961985afe0 RDI: 0x0000000000000008 RSI: 0x00007ffc0bd936e8 R8: 0x00007f9619625770 R9: 0x00007f961c5723f8 R10: 0x00007f961bd09e90 R11: 0x00007f961c807a60 R12: 0x00007f961cbe9800 R13: 0x0000000000000000 R14: 0x00007f961c66b840 R15: 0x0000000000000001 EFL: 0x0000000000010216
I have success following --> https://www.tensorflow.org/tutorials/image_retraining I changed the input to 'Mul' and output to 'final_result'
I also changed the input operations to
input = Const(scope_class, image_file)
output = input.operation.g.AddOperation(Tensorflow::OpSpec.new('ReadFile', 'ReadFile', nil, [input]))
output = input.operation.g.AddOperation(Tensorflow::OpSpec.new('DecodeJpeg', 'DecodeJpeg', Hash['channels' => 3], [output.output(0)]))
output = input.operation.g.AddOperation(Tensorflow::OpSpec.new('Cast', 'Cast', Hash['DstT' => 1], [output.output(0)]))
output = input.operation.g.AddOperation(Tensorflow::OpSpec.new('ExpandDims', 'ExpandDims', nil, [output.output(0), Const(scope_class.subscope('make_batch'), 0, :int32)]))
output = input.operation.g.AddOperation(Tensorflow::OpSpec.new('ResizeBilinear', 'ResizeBilinear', nil, [output.output(0), Const(scope_class.subscope('size'), [299, 299], :int32)]))
output = input.operation.g.AddOperation(Tensorflow::OpSpec.new('Sub', 'Sub', nil, [output.output(0), Const(scope_class.subscope('mean'), 117.00, :float)]))
output = input.operation.g.AddOperation(Tensorflow::OpSpec.new('Mul', 'Mul', nil, [output.output(0), Const(scope_class.subscope('scale'), 1.00, :float)])).output(0)
graph = scope_class.graph
session_op = Tensorflow::Session_options.new
session = Tensorflow::Session.new(graph, session_op)
out_tensor = session.run({}, [output], [])
I changed the input operations by matching the them to the graph in tensorboard.
@joegyoung Thanks a lot for this.
There end up being any usage tutorials?
Redo the Basic Usage Python tutorial in Ruby. Probably a few of the features from the Python-tutorial will not be available for the 0.1.0 Milestone (e.g.
tf.InteractiveSession()
), and can be skipped, but the basics of creating ops, evaluating/feeding tensors etc. should be shown.