GithubHelp home page GithubHelp logo

chekoduadarsh / optimization-of-retinex-and-image-processing-algorithms Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 115.22 MB

This project analysis and optimizes Retinex image enhancement algorithm for embedded system applications

License: MIT License

C++ 100.00%
optimization retinex hardware-optimization parellel-programming computer-vision multi-threading

optimization-of-retinex-and-image-processing-algorithms's Introduction

Optimization for Video Processing

Paper : https://dl.acm.org/citation.cfm?id=3339326

Optimization is the process of the action of making the best or most effective use of a situation or resource. In this scenario optimization is used to solve the issue of the high time requirement of the algorithm, software and hardware optimization was performed on the program to a point where it was able to in real-time on the hardware board used. Here, we discuss the entire procedure of the process implemented.

Software Optimization

The best way to run a process faster is to divide the main process into multiple threads that can run in parallel with respect to each other. This way we can make maximum utilization of the CPU, thereby decreasing the processing time. It’s also important to take into consideration the number of threads that can be handled efficiently by the operating system. Two threads were found to be the optimum number of threads that could produce the transformation with the least processing time. With more than two threads the communication time between the threads slows the process down. The memory model architecture is depicted in the below figure. The above memory model was developed for video processing application. First, the individual frames of the video are pushed into the input buffer one at a time. The first thread takes the first frame followed by the second thread that takes the next thread and the same pattern follows till the end of the video. In this manner the task is divided among the threads which are executed concurrently. After the threads are done with their job, the processed frames are stored in an output queue from where they are accessed to be shown on the output display.

Threading

Multi threading is a very efficient way of implementing parallelism into the code.Generally categorized into,

  • Thread
  • PThread
  • WinThread

After threading each thread can be run on different core to achieve 100% CPU utilization

In my code I have used following type of memory model where each thread independently process each frame reducing problems like deadlock.

thread memory model

Hardware Optimization

CPU Optimization

The most time-consuming process of the Retinex algorithm is the computation of the log functions. Also, the log functions need to be calculated for the R, G and B spectral components of the frames separately. In spite of running multiple threads together, computing the log functions for each frames’ RGB components is still a laborious task for the processor. To overcome this, the log values were calculated at the beginning of the program for the required range and stored in the memory as a lookup table. Instead of calling the log function, the pre-defined values are accessed directly. Accessing a memory happens faster than computing a set of equations, which therefore increases the performance speed of the algorithm. With this adjustment the speed of the algorithm doubled compared to when multi- threading was done with regular log computation.

GPU Optimization

GPUs are generally used for accelerating programs by providing high throughput. Thus, highly parallelizable tasks can be run on GPU efficiently. For e.g., Gaming, Artificial Neural Networks etc.

Heterogeneous Computing

Heterogeneous computing refers to systems that use more than one kind of processor or cores. These systems gain performance or energy efficiency not just by adding the same type of processors, but by adding dissimilar coprocessors, usually incorporating specialized processing capabilities to handle particular tasks. Using GPUs alone to process a complex computational problem is one part of improving performance drastically. However, to get close to the theoretical peak performance of the system, the CPU has to be utilized in a useful way, too, instead of it having only act as a supervisor for the GPU. Combining the different paradigms and programming models of CPUs and GPUs to work together at the same problem must be the ultimate goal. When ever we deploy a process on Heterogenous or parallel manner we need to keep a thread or ideally main program to be master to control other slave device and thread. Master will be looking into ,

  1. Process execution status
  2. Availability of data
  3. Presence of redundant wait time

Consider the diagram given below this is one of the simple heterogeneous computation method.

GPU memory model

Implemented Video Processing Algorithms

  1. SSR
  2. MSR

note : please refer the research papers for explanation of algorithms

Results Obtained

The Above algorithms are implemented on various embedded hardware boards and the result obtained is as below

1. Single Scale Retinex

-without optimzation on UDOOx86 Ultra

Frames Duration FPS
500 126.10s 4
900 227.32s 4

-with optimzation on UDOOx86 Ultra

Frames Duration FPS
500 14.56s 34
900 26.46s 34

-without optimzation on Jetson Tk1

Frames Duration FPS
500 156.10s 3
900 283.32s 3

-with optimzation on Jetson Tk1

Frames Duration FPS
500 17.73s 28
900 32.02s 28

2. Multi Scale Retinex

-without optimzation on UDOOx86 Ultra

Frames Duration FPS
500 243.10s 2
900 464.32s 2

-with optimzation on UDOOx86 Ultra

Frames Duration FPS
500 18.02s 28
900 31.96s 28

-without optimzation on Jetson Tk1

Frames Duration FPS
500 256.10s 2
900 483.32s 2

-with optimzation on Jetson Tk1

Frames Duration FPS
500 20.23s 25
900 35.98s 25

Download

Download

Citation

Majumdar, Jharna & C, Adarsh & Singh, Harshpreet & C, Rahul. (2019). Real-time performance analysis of retinex algorithm on embedded boards for robotics application. ICAICR '19: Proceedings of the Third International Conference on Advanced Informatics for Computing Research. 1-8. 10.1145/3339311.3339326.

optimization-of-retinex-and-image-processing-algorithms's People

Contributors

chekoduadarsh avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

optimization-of-retinex-and-image-processing-algorithms's Issues

TODO

Hey guys, This is an open Repo for image-processing and video processing optimization enthusiast, If you anything to contribute put an issue lets have a talk or put a pull request.
Note:- This repo is not concentrated on the Retinex Algorithm only if there are other image processing algorithms we will update the readme and project title according to the updates to come and first timers dont worry much put your effort and pull your ideas

  • Implementing more video processing algorithms
  • Implementation in Laptops (PC) and comparison
  • Comparison Between pthreads vs thread in performance
  • Implementation of OpenMP

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.