MCPcopy Create free account
hub / github.com/OpenPTrack/open_ptrack_v2 / processFrame

Function processFrame

rtpose_wrapper/apps/rtpose.cpp:1525–1681  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1523
1524
1525void* processFrame(void *i) {
1526 int tid = *((int *) i);
1527 warmup(tid);
1528 LOG(INFO) << "GPU " << tid << " is ready";
1529 Frame frame;
1530
1531 int offset = NET_RESOLUTION_WIDTH * NET_RESOLUTION_HEIGHT * 3;
1532 //bool empty = false;
1533
1534 Frame frame_batch[BATCH_SIZE];
1535
1536 std::vector< std::vector<double>> subset;
1537 std::vector< std::vector< std::vector<double> > > connection;
1538
1539 const boost::shared_ptr<caffe::Blob<float>> heatmap_blob =
1540 net_copies[tid].person_net->blob_by_name("resized_map");
1541 const boost::shared_ptr<caffe::Blob<float>> joints_blob =
1542 net_copies[tid].person_net->blob_by_name("joints");
1543
1544 caffe::NmsLayer<float> *nms_layer =
1545 (caffe::NmsLayer<float>*)net_copies[tid].person_net->
1546 layer_by_name("nms").get();
1547
1548 //while(!empty) {
1549 while(1) {
1550 //LOG(ERROR) << "start";
1551 int valid_data = 0;
1552 //for(int n = 0; n < BATCH_SIZE; n++) {
1553 ROS_INFO_STREAM_COND(DEBUG > 1, "PRCFRAME: Wait");
1554 std::unique_lock<std::mutex> lk(global.input_queue_mutex);
1555 global.input_queue_cond.wait(lk, [](){return
1556 global.input_queue.size() > 0;});
1557 ROS_INFO_STREAM_COND(DEBUG > 1, "PRCFRAME: Gooo");
1558 while(valid_data<1 && global.input_queue.size() > 0) {
1559 if (global.quit_threads or !ros::ok())
1560 break;
1561 frame = global.input_queue.pop();
1562 global.get_frames_cond.notify_one();
1563 //consider dropping it
1564 frame.gpu_fetched_time = get_wall_time();
1565 double elaspsed_time = frame.gpu_fetched_time - frame.commit_time;
1566 if (elaspsed_time > 0.1
1567 && !_no_frame_drops) {//0.1*BATCH_SIZE) { //0.1*BATCH_SIZE
1568 //drop frame
1569 VLOG(1) << "skip frame " << frame.index;
1570 delete [] frame.data;
1571 delete [] frame.data_for_mat;
1572 delete [] frame.data_for_wrap;
1573 {
1574 ROS_INFO_STREAM_COND(DEBUG > 1, "PRCFRAME: Wait depthQueue");
1575 std::lock_guard<std::recursive_mutex> lock(_depth_queue_mutex);
1576 _depth_queue.erase(frame.index);
1577 ROS_INFO_STREAM_COND(DEBUG > 1, "PRCFRAME: Release depthQueue");
1578 }
1579 //n--;
1580
1581 const std::lock_guard<std::mutex> lock{global.mutex};
1582 global.dropped_index.push(frame.index);

Callers

nothing calls this directly

Calls 15

warmupFunction · 0.85
get_wall_timeFunction · 0.85
connectLimbsFunction · 0.85
connectLimbsCOCOFunction · 0.85
renderFunction · 0.85
blob_by_nameMethod · 0.80
layer_by_nameMethod · 0.80
popMethod · 0.80
pushMethod · 0.80
SetThresholdMethod · 0.80
ForwardFromMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected