Code Monkey home page Code Monkey logo

Comments (1)

szaza avatar szaza commented on September 15, 2024

Hi,
First of all, I am very glad that you reused this little example project for developing your drone object detection application. The process to capture the video stream and to transform into the required sizes is a little bit complicated, but let me try to explain it shortly.

The main component for the video capturing is the CameraConnectionFragment, which uses the camera2 API to get the video stream. It uses the ImageFormat.YUV_420_888 format, which has several advantages over the standard RGB representation. For more information about the YUV representation please see this article: https://en.wikipedia.org/wiki/YUV.

The second most important class for the video stream processing is the ClassifierActivity which uses the CameraConnectionFragment by extending the TextToSpeechActivity, which extends the CameraActivity.
Inside the onPreviewSizeChosen() method a bitmap is created, named croppedBitmap, which it is used for storing temporarly each frames. This method also defines the transformations to resize and rotate the input image: frameToCropTransform.

The ClassifierActivity.onImageAvailable method is called when an input image arrives through the camera2 API and it executes the fillCroppedBitmap() method, which is the most important method.
It converts the YUV input bytes to bitmap format by using the ImageUtils.convertYUVToARGB() method, then executes the transformation which is defined in the frameToCropTransformation variable. Finally, the result is copied to the croppedBitmap which is forwarded to the YOLOv2 classifier. The transformations mentioned above are executed for each frames.

I also had problems with the quality of the images and with the accuracy of the tiny yolov2. Unfortunately, I could only resolve it by creating a client-server architecture. This way I could process larger images, and I could use more accurate models than the tiny yolov2. If you are interested in the solution please see this repository: https://github.com/szaza/set-detector. This way you can stream a video for the server, which processes your request and sends back the results.

I hope that these information help you and I wish all the best for your further work!

Best regards,
Zoltan

from android-yolo-v2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.