-
Notifications
You must be signed in to change notification settings - Fork 74k
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
Android Demo DetectorActivity landscape orientation problem #9412
Comments
By any chance are you referring to the fact that it draws them correctly in the debug preview but off to the side and squished in the main view? |
If you look at the preview screen bottom right you will see that your input is coming through on it's side. That debug preview screen is what goes through the model. As it is on it's side the model will not preform as expected. That's why in landscape you're getting nonsense predictions. Almost all image recognition problems are NOT rotation invariant. On another note, you'll notice that the blue train box is being drawn on a part of the image that isn't in the preview that goes through the model. That's because the rectangle drawing functions don't work correctly when the app is changed to landscape. I am also struggling with this issue and hope @andrewharp is able to comment on that particular issue. (Probably not a bug but rather me being too rubbish at understanding the source code), |
I tried this:
So debug preview looks fine now So now it's only main view. |
Yes that is the way to force the rotation. I also found problems with the rotation. I guess this is kind of linked with #9416 that @andrewharp has been assisting with. Regarding the boxes on the main view, it is on my todo list to try and figure out but will be a few weeks away if anyone else has any ideas? |
I tried to force rotation in the different part of code.
|
I am also struggling with landscape mode for drawing correct rectangles around objects. Debug looks totally valid only preview side is remaining. any progress on this? |
I have the same issue. Any luck till recently? |
I solved this problem. |
@Nanamare can you tell us how you solved the issue? |
@Nanamare We'd love to have this as a contribution, if you'd be up for submitting a pull request! |
@Nanamare great, if the problem was related to then maybe you understand code pretty well and could also help with Yolo detector in Java for Windows/Ubuntu I already made a project in IntelliJ IDEA, I posted a result and full java classes from the project in my question https://stackoverflow.com/questions/47077983/yolo-detector-in-java I'm just doing this for fun, it's just cool that we can run Tensorflow just everywhere and using different programming frameworks, languages, devices |
I've made a fix for this internally, should show up in the next push. You'll still have to manually change the orientation of the Activity in AndroidManifest.xml, but everything else should just work afterwards. |
@gunan @andrewharp will this work with screenOrientation="sensor" or screenOrientation="fullSensor"? Thanks. |
I downloaded the latest android example project and set debug is ok, but still something wrong with main ui view and its orientation: TF Detect (SSD-Mobilene) Activity p.s. I fixed java project (windows/ubuntu) for tensorflow yolo2/tiny yolo detector: https://stackoverflow.com/a/47632412/7767664 |
Have you solved it, please? |
@andrewharp I changed the orientation but it stays just as @anonym24 described... Any idea on how to fix this? |
I am having some issue camera is opening only 70% to the screen Remaining 30% of the screen is black. Any suggestion or solution how to fix that? |
Hi I have integrated tensor flow with YOLO in android. and I want to detect the objects in landscape and I also want camera preview in full screen. I have changed to support in landscape mode by changing Change the camera preview size by adding Please help me to show the preview of a camera in full screen and also support for a landscape to detect the objects Thanks |
@shruti-mahajan |
Ok, Thanks |
Hi I want to get the distance of detected objects. Please guide me how to get the distance of detected objects. Actually, I already searched on the internet and I didn't get any idea. Thanks |
@shruti-mahajan you should not ask for help for such tasks here, it's not about TensorFlow at all. |
Just pulled the latest demo, still cannott change to landscape mode by simply changing the screenOrientation in manifest.xml, and change to auto rotate didn`t work for me @prasanna532 Here`s my work around: In DetectorActivity: In MultiBoxTracker:
In env/BorderedText:
|
I commented out the portion in set fragment, which is calling the legacy connection fragment. Then landscape mode seems to work without any changes(except in the manifest file) - camera2api being used. (Incase, we want to retain the if..else block and want the legacy fragment to be called, then need to make changes in legacyconnectionfragment.java file corresponding to landscape mode.) |
I have the same problem with newest example file. Please guide me how to change the screen orientation to landscape. I have tried all suggested modification here, but it does not work. |
I've solved the landscape orientation problem thanks to @MICHAEL-ZENZ. However, the issue of 30% black rectangle @prasanna532 at the bottom stayed in both landscape and vertical orientations. Please, need help. |
I'm trying to change the orientation to landscape:
private static final Size DESIRED_PREVIEW_SIZE = new Size(1280, 720);
private static final boolean USE_YOLO = true
But it draws detected rects wrongly.
How to fix it?
The text was updated successfully, but these errors were encountered: