Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing kernel_width/height computations to floating-point #5

Open
menglin0320 opened this issue Oct 9, 2016 · 1 comment
Open

Comments

@menglin0320
Copy link

menglin0320 commented Oct 9, 2016

If you read the roi-pooling layer on here you can see that their code can handel the case if width and height of input kernel is smaller than the output.

because you wrote
int kernel_width = roi_width / pooling_width;
int kernel_height = roi_height / pooling_height; in this way , you can't handle any pooled_size not divide by input_size.
I modified your code a little bit and the modified code is here
I don't know backpropagate well, do I also have to modify that to accompany my change in your script?

@zplizzi
Copy link
Owner

zplizzi commented Oct 15, 2016

@menglin0320 good catch. I knew it would not handle the case where the ROI is smaller than the output (as evidenced by the comment in the code), but that situation should generally be avoided anyways (I avoid it by filtering out any ROIs that are too small). However, changing the result of the division to a floating-point representation would result in a bit less position error than how code currently stands for larger ROIs.

The gradient code should not require any changes.

Feel free to submit a PR with your fixes.

@zplizzi zplizzi changed the title Your implementation has a serious problem Changing kernel_width/height computations to floating-point Oct 15, 2016
kimkilho pushed a commit to kimkilho/tensorflow-fast-rcnn that referenced this issue Dec 23, 2016
objects.

See the added javadoc comments and unittests (TensorTest.java) for
an explanation of the API. The conversion between Java types and the
Tensor class does involve a single copy.

For Java object -> TF_Tensor, a single JNI function (setValue) suffices.

For TF_Tensor -> Java object, I couldn't work out a scheme that didn't
require a separate JNI function for each primitive type and one JNI function
for non-scalars.

However, since all these JNI methods are private and not part of the
exposed Java API, I figured the "cost" asymmetry in the conversion functions
was worth the "benefit" of fewer JNI methods.

Another step towards zplizzi#5
Change: 140871139
kimkilho pushed a commit to kimkilho/tensorflow-fast-rcnn that referenced this issue Dec 23, 2016
There were two bugs:
- The string constant kNullPointerException had a typo in its value
- The scalar value accessors weren't checking for a valid handle

Fixed those, added tests and moved the utility function throwException
to its own file since I plan to use that in JNI files for the other
Java classes in the future.

Another step in the journey that is zplizzi#5
Change: 141091613
kimkilho pushed a commit to kimkilho/tensorflow-fast-rcnn that referenced this issue Dec 23, 2016
This change introduces a package private static method to create
a Java Tensor object from the handle to the native TF_Tensor object.
This will be needed to create the output Tensor objects produced
by graph execution (when the equivalent of a Session and it's run()
method are introduced in Java).

Yet another step in the journey that is zplizzi#5
Change: 141096422
kimkilho pushed a commit to kimkilho/tensorflow-fast-rcnn that referenced this issue Dec 23, 2016
Also link in op definitions into libtensorflow-jni.so

Another step in the journey that is zplizzi#5.
Change: 141113176
kimkilho pushed a commit to kimkilho/tensorflow-fast-rcnn that referenced this issue Dec 23, 2016
Add the Operation and Output classes and the ability to query
an Operation in an Graph by name.

Another step in the journey that is zplizzi#5
Change: 141122031
kimkilho pushed a commit to kimkilho/tensorflow-fast-rcnn that referenced this issue Dec 23, 2016
Yet another step in the journey that is zplizzi#5.
Change: 141211730
kimkilho pushed a commit to kimkilho/tensorflow-fast-rcnn that referenced this issue Dec 23, 2016
This change adds support for string scalars used by
popular operations like DecodeJpeg. Vectors, matrices
and higher-dimensional string tensors are left as an
excercise for the future.

Note that the TF_STRING data type in TensorFlow corresponds to a byte[] in
Java (not a String) since it is used for arbitrary bytes, not just
strings of unicode characters.

One more step in the journey that is zplizzi#5
Change: 141221096
kimkilho pushed a commit to kimkilho/tensorflow-fast-rcnn that referenced this issue Dec 23, 2016
Command-line program to:
- Construct an image normalization graph G1
- Execute G1 in a session to produce a tensor of a batch of images
- Import a pre-trained inception model into a graph G2
- Execute G2 in a session to find the best matching label

In other words, the Java equivalent of:
- C++ example https://github.com/tensorflow/tensorflow/tree/abbb4c1/tensorflow/examples/label_image
- Go example
https://github.com/tensorflow/tensorflow/blob/c427b7e89d1498b78d361bfe7345b2636a438893/tensorflow/go/example_inception_inference_test.go

Another step in the journey that is zplizzi#5
Change: 141247499
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants