Tensorflow-Java Image Comparison -


i new tensorflow, loads of basic doubts :-)

i have 2 identical images(dogs), edited 1 (i.e cut small piece of dog, please don't hate me in in name of science) have created tensor out these 2 images, when print tensor has same value, shouldn't 2 different values ? how tell difference between these 2 images? want measure how , changed between these 2 images.

tensor:- [172, 293, 3, 1]  code:-   final output input = b.constant("input", imgbytes);   output = b.expanddims(                   b.cast(b.decodejpeg(input, 3), datatype.float),                   b.constant("make_batch", 3));    try (session s = new session(g)) {       t = s.runner().fetch(output.op().name()).run().get(0);   }   system.out.println("output1="+t.tostring()); 

@pyb, code format.

tensor.tostring() not return value of contents of tensor. returns string describing metadata - shape , type (see linked javadoc).

i suspect string [172, 293, 3, 1] truncated form of tensor.tostring() actually prints, float tensor shape [172, 293, 3, 1].

if case, see same string because both images have same dimensions (they 172x293x3 pixel images).

to see contents of tensor, see tensor.writeto or tensor.copyto

for example:

float[][][] contents = t.copyto(new float[172][293][3]); system.out.println(arrays.tostring(contents)); 

hope helps.


Comments

Popular posts from this blog

What is happening when Matlab is starting a "parallel pool"? -

angular - DownloadURL return null in below code -

php - Cannot override Laravel Spark authentication with own implementation -