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

support camera frame data pipeline ? #529

Open
lix19937 opened this issue Nov 10, 2023 · 2 comments
Open

support camera frame data pipeline ? #529

lix19937 opened this issue Nov 10, 2023 · 2 comments
Labels
enhancement New feature or request help wanted Extra attention is needed question Further information is requested

Comments

@lix19937
Copy link

lix19937 commented Nov 10, 2023

It does not support data-driven pipeline or not ? like camera frame data pipeline, camera keep a fixed frame rate, see #148.
If Graph Processing Pipeline support, how to use ? Thanks !

Like OpenVX graph model.
vx

vx-p
Graph pipelining allow users to schedule a graph multiple times, without having to wait for a graph execution to complete. Each such execution of the graph operates on different input or output references.

// follow is my code, run the taskflow iteratively with changing frame data

I think follow is not right.

#include <taskflow/taskflow.hpp>

int main(){

  tf::Executor executor;
  tf::Taskflow taskflow("camera pipeline");
  
  // camera frame data   
  void *data_in{nullptr}; 
  
  // out of node(task) 
  A_OUT a_out;
  B_OUT b_out;
  C_OUT c_out;

  // create a task and attach it the camera data
  auto NodeA = taskflow.placeholder();
  NodeA.data(&data_in).work([NodeA, &a_out](){
    // task impl api
    // ...
   }); 
  
  auto NodeB = taskflow.placeholder();
  NodeB.data(&a_out).work([NodeB, &b_out](){
    // task impl api
    // ...
  });

  auto NodeC = taskflow.placeholder();
  NodeB.data(&b_out).work([NodeC, &c_out](){
    // task impl api
    // ...
  });

  NodeA.precede(NodeB);
  NodeB.precede(NodeC);

  // iteratively with changing camera data
  while(1){

    // get camera data here, define in other    
    GetCameraData(data_in);
    
    // here maybe wrong, here next frame`s should wait last frame process done   !!!   
    executor.run(taskflow).wait();

  }

  return 0;
}
@fangchaooo
Copy link

DFS Scheduler always process full Node.
A fixed Process is below:

// define a frame processing ITERATION ie. 10Hz
define ITERATION 100
while(True){
  
  while(pipline.alive() || pipline.ready()){
    auto start = std::chrono::high_resolution_clock::now();
    auto iteration = std::chrono::high_resolution_clock::now();
    if(pipline.timeout()){
      break;
    }
    if(data.error() || process.error()){
      break;
    }
    
    auto duration_ = std::chrono::duration_cast<std::chrono::microseconds>(
                         std::chrono::high_resolution_clock::now() - iteration)
                         .count();
    // Calculate the remaining time to wait
    auto remainingTime = std::chrono::microseconds(ITERATION) -
                         std::chrono::microseconds(duration_);

    if (remainingTime.count() > 0)
    {
      std::this_thread::sleep_for(remainingTime);
    }
  }

}


You should split your pipline, example creating a chain for three pipline. Giving each pipline a timeout, or node timeout.

@lix19937
Copy link
Author

lix19937 commented Jan 6, 2024

@fangchaooo thanks, can you show a sample about pipeline you defined ?

@tsung-wei-huang tsung-wei-huang added enhancement New feature or request help wanted Extra attention is needed question Further information is requested labels Feb 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants