NVIDIA DeepStream SDK API Reference

9.1 Release
sources/apps/sample_apps/deepstream-transfer-learning-app/image_meta_producer.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2020-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: Apache-2.0
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #pragma once
19 
20 #include <sstream>
21 #include <iomanip>
22 #include <fstream>
23 #include <chrono>
24 #include <ctime>
25 #include "image_meta_consumer.h"
26 #include "concurrent_queue.h"
27 
29 {
30 public:
31  // left: filepath for multiple file, right: file content
32  typedef std::pair<std::string, std::string> string_pair;
34  struct IPData
35  {
36  float confidence = 0.f;
38  unsigned class_id = 0;
39  unsigned current_frame = 0;
40  unsigned video_stream_nb = 0;
41  std::string class_name;
42  std::string video_path;
45  std::string datetime;
46  unsigned img_height = 0;
47  unsigned img_width = 0;
48  unsigned img_top = 0;
49  unsigned img_left = 0;
50  };
51 
56  bool stack_obj_data(IPData &data);
61  void generate_image_full_frame_path(const unsigned stream_source_id,
62  const std::string &datetime_iso8601);
64  std::string get_image_full_frame_path_saved();
65 
66 private:
67 
69  std::string make_csv_data(const IPData &data);
71  std::string make_json_data(const IPData &data);
73  std::string make_kitti_data(const IPData &data);
75  std::string make_kitti_save_path() const;
76 
77  std::string image_full_frame_path_saved_;
78  std::vector<std::string> obj_data_csv_;
79  std::vector<std::string> obj_data_json_;
80  std::vector<std::string> obj_data_kitti_;
81  ImageMetaConsumer &ic_;
82 };
ImageMetaProducer::IPData::img_height
unsigned img_height
Definition: sources/apps/sample_apps/deepstream-transfer-learning-app/image_meta_producer.h:46
ImageMetaProducer::IPData::within_confidence
bool within_confidence
Definition: sources/apps/sample_apps/deepstream-transfer-learning-app/image_meta_producer.h:37
concurrent_queue.h
ImageMetaProducer::IPData
Content that will converted to string and sent to consumer.
Definition: sources/apps/sample_apps/deepstream-transfer-learning-app/image_meta_producer.h:34
ImageMetaProducer::IPData::video_path
std::string video_path
Definition: sources/apps/sample_apps/deepstream-transfer-learning-app/image_meta_producer.h:42
ImageMetaProducer::IPData::confidence
float confidence
Definition: sources/apps/sample_apps/deepstream-transfer-learning-app/image_meta_producer.h:36
ImageMetaProducer::string_pair
std::pair< std::string, std::string > string_pair
Definition: sources/apps/sample_apps/deepstream-transfer-learning-app/image_meta_producer.h:32
ImageMetaProducer::get_image_full_frame_path_saved
std::string get_image_full_frame_path_saved()
Returns locally stored path to complete image.
ImageMetaProducer::ImageMetaProducer
ImageMetaProducer(ImageMetaConsumer &ic)
Constructor registering a consumer.
ImageMetaProducer::IPData::img_width
unsigned img_width
Definition: sources/apps/sample_apps/deepstream-transfer-learning-app/image_meta_producer.h:47
ImageMetaConsumer
Definition: sources/apps/sample_apps/deepstream-transfer-learning-app/image_meta_consumer.h:42
ImageMetaProducer::IPData::image_full_frame_path_saved
std::string image_full_frame_path_saved
Definition: sources/apps/sample_apps/deepstream-transfer-learning-app/image_meta_producer.h:43
ImageMetaProducer::IPData::img_left
unsigned img_left
Definition: sources/apps/sample_apps/deepstream-transfer-learning-app/image_meta_producer.h:49
ImageMetaProducer::IPData::datetime
std::string datetime
Definition: sources/apps/sample_apps/deepstream-transfer-learning-app/image_meta_producer.h:45
ImageMetaProducer::stack_obj_data
bool stack_obj_data(IPData &data)
store metadata information locally before send it.
ImageMetaProducer::IPData::image_cropped_obj_path_saved
std::string image_cropped_obj_path_saved
Definition: sources/apps/sample_apps/deepstream-transfer-learning-app/image_meta_producer.h:44
ImageMetaProducer::IPData::current_frame
unsigned current_frame
Definition: sources/apps/sample_apps/deepstream-transfer-learning-app/image_meta_producer.h:39
ImageMetaProducer::IPData::img_top
unsigned img_top
Definition: sources/apps/sample_apps/deepstream-transfer-learning-app/image_meta_producer.h:48
ImageMetaProducer::IPData::video_stream_nb
unsigned video_stream_nb
Definition: sources/apps/sample_apps/deepstream-transfer-learning-app/image_meta_producer.h:40
ImageMetaProducer::IPData::class_id
unsigned class_id
Definition: sources/apps/sample_apps/deepstream-transfer-learning-app/image_meta_producer.h:38
ImageMetaProducer::send_and_flush_obj_data
void send_and_flush_obj_data()
send metadata stored (after some processing for KITTI type).
ImageMetaProducer
Definition: sources/apps/sample_apps/deepstream-transfer-learning-app/image_meta_producer.h:28
ImageMetaProducer::generate_image_full_frame_path
void generate_image_full_frame_path(const unsigned stream_source_id, const std::string &datetime_iso8601)
Create and store locally a path to a complete image.
image_meta_consumer.h
ImageMetaProducer::IPData::class_name
std::string class_name
Definition: sources/apps/sample_apps/deepstream-transfer-learning-app/image_meta_producer.h:41