Object-Detection | android application which shows how a trained TensorFlow | Android library
kandi X-RAY | Object-Detection Summary
kandi X-RAY | Object-Detection Summary
This is an android application which shows how a trained TensorFlow lite Object detector file can be used in an android.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Performs a background detection
- Handle detection
- Process a list of results
- Updates the next frame
- Called when the preview size is selected
- Creates a TensorFlow session
- Draws debug information
- Draws a circle to the canvas
- Resume the inference thread
- Performs the background draw on the canvas
- Returns the simple name of the caller
- Convert size string to size list
- Gets debug text
- Resume the view
- Resume the application
- Calculates the focal length of the camera
- Sets the measured dimensions to the desired dimension
- Given a bitmap returns a list of Recognized images
- Invoked when an image is available
- Creates the camera preview session
- Processes a preview frame
- Initialise the TextToSpeech
- Initializes the activity
- Stop the handler thread
- Polls the flow data for the given end frame time
- Convert size list to string
Object-Detection Key Features
Object-Detection Examples and Code Snippets
Community Discussions
Trending Discussions on Object-Detection
QUESTION
The Question
How do I best execute memory-intensive pipelines in Apache Beam?
Background
I've written a pipeline that takes the Naemura Bird dataset and converts the images and annotations to TF Records with TF Examples of the required format for the TF object detection API.
I tested the pipeline using DirectRunner with a small subset of images (4 or 5) and it worked fine.
The Problem
When running the pipeline with a bigger data set (day 1 of 3, ~21GB) it crashes after a while with a non-descriptive SIGKILL
.
I do see a memory peak before the crash and assume that the process is killed because of a too high memory load.
I ran the pipeline through strace
. These are the last lines in the trace:
ANSWER
Answered 2021-Jun-15 at 13:51Multiple things could cause this behaviour, because the pipeline runs fine with less Data, analysing what has changed could lead us to a resolution.
Option 1 : clean your input dataThe third line of the logs you provide might indicate that you're processing unclean data in your bigger pipeline mmap(NULL,
could mean that | "Get Content" >> beam.Map(lambda x: x.read_utf8())
is trying to read a null value.
Is there an empty file somewhere ? Are your files utf8 encoded ?
Option 2 : use smaller files as inputI'm guessing using the fileio.ReadMatches()
will try to load into memory the whole file, if your file is bigger than your memory, this could lead to errors. Can you split your data into smaller files ?
If files are too big for your current machine with a DirectRunner
you could try to use an on-demand infrastructure using another runner on the Cloud such as DataflowRunner
QUESTION
While running models/research/object_detection/model_main_tf2.py
from tensorflow/models
(or just python -c "from object_detection import model_lib_v2"
) I get:
ANSWER
Answered 2021-May-28 at 14:40I managed to resolve by downgrading Pillow to 7.0.0, downgrading numpy to 1.19.5 (which is the latest version still compatible with tensorflow 2.5.0 at the moment) and downgrading pycocotools to 2.0.0.
QUESTION
Summary/TL;DR: ML Object Detection application is unable to detect objects because images aren't being acquired by analyze()
method.
I'm currently working on a mobile application using CameraX and Google ML Kit written in Java. The purpose of the application is to detect objects with a real time camera preview. I implemented ML Kit using this guide aptly titled "Detect and track objects with ML Kit on Android" (base model option) to detect objects in successive frames within the application.
However, upon running the application, it launches on my device and the camera preview continues to work but the application does not carry out its intended effect of actually detecting objects and displaying it on my screen. To attempt to resolve this, I had found this StackOverflow answer that very closely resembles this issue. To my dismay, the user had built their application using a custom model (tflite). This differs from mine as I am using the base model. According to my research, this uses the ML Kit's on-device's object detection. The code being applied is restricted to what is present within the aforementioned documentation. Since my IDE (Android Studio) does not display any errors within the syntax, I am unsure as to why any object detection does not appear to be present on my application. Displayed below is the necessary code that had been used:
CODE ...ANSWER
Answered 2021-Apr-02 at 18:33As mentioned in the other StackOverflow question you linked, you need to bind the analysis use case to make it work.
One tip to help debug this is that you can add some Log.d(..) in onSuccess to check the size of the returned object list and in onFailure to print out the exception. Then when running, you could use adb logcat or the AS log tab to check the info to make sure things are running.
Another improvement you can make is that, you don't need to create a new object detector each frame. You can create one out side the analyze method and reuse it.
QUESTION
I followed the "Training Custom Object Detector" tutorial (https://tensorflow-object-detection-api-tutorial.readthedocs.io/en/latest/training.html)
When running the script to continue training a pre-trained model:
python model_main_tf2.py --model_dir=models/my_ssd_resnet50_v1_fpn --pipeline_config_path=models/my_ssd_resnet50_v1_fpn/pipeline.config
(found here: https://github.com/tensorflow/models/blob/master/research/object_detection/model_main_tf2.py)
Using different numpy versions, I get the following errors.
Scenario #1:
- tensorflow: 2.2.0
- numpy: 1.20.0-1
NotImplementedError: Cannot convert a symbolic Tensor (cond_2/strided_slice:0) to a numpy array. This error may indicate that you're trying to pass a Tensor to a NumPy call, which is not supported
I looked online and it suggests to downgrade the numpy version < 1.20.0 (NotImplementedError: Cannot convert a symbolic Tensor (2nd_target:0) to a numpy array). Note, the version numpy version must be >= 1.19.2 for tensorflow 2.2.0.
Scenario #2:
- tensorflow: 2.2.0
- numpy: 1.19.2-5
ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject
However, the online recommendation is to upgrade numpy to >= 1.20.0. (ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject). There is a github issue related to this: https://github.com/tensorflow/models/issues/9749.
I'm not sure what version to use to get the code running.
Appendix: Scenario #1 Error Code (numpy: 1.20.0-1)
...ANSWER
Answered 2021-Feb-26 at 09:25I had the same error. Are you on windows? If so try (that worked for me):
pip uninstall pycocotools
pip install pycocotools-windows
QUESTION
I ran through the TensorFlow object detection installation on Windows.
https://medium.com/riow/tensorflow-object-detection-on-windows-ad10bfde217c
After successfully installing TensorFlow object detection,
I ran following command to test, and receiving error below. How can this be fixed?
...ANSWER
Answered 2021-Apr-26 at 06:10You need to install the C++ redistributable mentioned on the install page before installing TensorFlow so that TensorFlow can use it to generate code at install time.
Details:I'm not an expert but it sounds like this was key:
The pywrap_tensorflow_internal.py
module you are missing appears to me to be a SWIG-generated python interface to a C++ library, or something of that nature. My guess is, that file gets generated when you install TensorFlow (it reminds me of how some Ruby gems have to compile C++ when you install them, for whatever that's worth). Since you don't have that generated file, my guess is that the C++ package mentioned on the TensorFlow install page is needed for that code generation, so you need to have the C++ package installed before installing TensorFlow.
Totally a guess, but perhaps you installed the C++ package after TF. In that case, you should be able to uninstall TF, install the C++ package, and then install TF again.
Maybe a lingering question is if there were any indicative error messages on installing TF about the missing C++ package and if not, maybe there should be.
QUESTION
I am trying to install Tensor Flow Object Detection on Windows 10.
After running these steps, we are receiving the errors below. It is stalling on pyarrow. How can this be fixed?
...ANSWER
Answered 2021-Apr-26 at 00:11I'm not exactly sure about that error, but for Tensorflow in general, if you go to this page, you'll see that, as of this writing, the only supported version of python are 3.6 - 3.8. It sounds like for tensorflow/models, you might do well to use 3.7. You will want to make sure you have a compatible version of pip as well.
QUESTION
I try to train a model object detection and I follow this tutorial: https://tensorflow-object-detection-api-tutorial.readthedocs.io/en/tensorflow-1.14/training.html
But at the end I execute the command in the cmd : python model_main.py --alsologtostderr --model_dir=training/ --pipeline_config_path=training/ssd_inception_v2_coco.config
and it return the following lines:
...ANSWER
Answered 2021-Apr-16 at 09:25Make sure that you run these commands before training/validation for installing all the necessary packages/dependencies and testing the installation
QUESTION
I am attempting to train an object detection model using Tensorflow's Object Detection API 2 and Tensorflow 2.3.0. I have largely been using this article as a resource in preparing the data and training the model.
Most articles which use the Object Detection API download a pre-trained model from the Tensorflow model zoo prior to fine-tuning.
The Tensorflow Model Zoo is a set of links on a Github page set up by the Object Detection team. When I click one such link (using Google Chrome), a new tab opens briefly as if a download is starting, then immediately closes and a download does not occur. Hyperlinks to other models I have found in articles also have not worked.
To anyone who has worked with fine-tuning using the Object Detection API: What method did you use to download a pre-trained model? Did the model zoo links work? If not, what resource did you use instead?
Any help is much appreciated.
...ANSWER
Answered 2021-Apr-13 at 16:14I solved this problem on my own, so if anyone else is having a similar issue: try a different browser. The model zoo downloads were not working for me in Google Chrome. However, when I tried the download on Microsoft Edge, it worked immediately and I was able to proceed.
QUESTION
I am running confusion matrix on my own custom model using Tensorflow Object Detection API. I am using Faster R-CNN Inception v2 pets. I get this output:
...ANSWER
Answered 2021-Apr-12 at 10:49Please check below image.
More information about confusion matrix can be found here. https://www.analyticsvidhya.com/blog/2020/04/confusion-matrix-machine-learning/
QUESTION
Based on what is written on the TensorFlow web page about object-detection API, I have trained a custom model, and its checkpoint is obtained successfully, now I am going to apply this trained model on a pre-captured video(not webcam frames). Now, I would like to know how can I do this? is there any pre-written code that can help me in this way? thanks for your comments. best wishes to you.
...ANSWER
Answered 2021-Apr-01 at 16:23Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install Object-Detection
You can use Object-Detection like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the Object-Detection component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page