Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -156,3 +156,7 @@ cmake-build-debug-remote/
cmake-build-debug/
build/*
!build/build.sh
swig/*.cs
swig/*.cxx
.vs/*
VideoPipe/*
21 changes: 15 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -fPIC -w -fdiagnostics-color=always -
# save all libs(including third_party's) to 'libs'
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/libs)

if(WIN32)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) # 自动导出所有符号
endif()


# optional for build, modify values when configure the project using 'cmake -DVP_WITH_CUDA=OFF ..'
option(VP_WITH_CUDA "prepared CUDA or not?" OFF)
option(VP_WITH_TRT "prepared TensorRT or not?" OFF)
Expand Down Expand Up @@ -43,7 +48,7 @@ include_directories(${GST_INCLUDE_DIRS})
set (GST_DEPEND_LIBS ${GST_LIBRARIES} ${GSTAPP_LIBRARIES} ${GST_RTSP_LIBRARIES})

# collect dependent libs for videopipe
list(APPEND VP_DEPEND_LIBS ${OpenCV_LIBS} ${GST_DEPEND_LIBS} stdc++fs)
list(APPEND VP_DEPEND_LIBS ${OpenCV_LIBS} ${GST_DEPEND_LIBS})

# optional for CUDA
if(VP_WITH_CUDA) # CUDA enabled
Expand Down Expand Up @@ -107,10 +112,9 @@ if(VP_WITH_LLM)
endif()

# tinyexpr
message("-------------start build tinyexpr--------------")
add_subdirectory(third_party/tinyexpr)
list(APPEND VP_DEPEND_LIBS tinyexpr)
message("--------------end build tinyexpr---------------")
find_package(unofficial-tinyexpr CONFIG REQUIRED)



message("-------------collect version info--------------")
string(TIMESTAMP BUILD_TIME "%Y%m%d-%H%M%S")
Expand Down Expand Up @@ -158,7 +162,12 @@ list(APPEND VP_CPPS_SOURCES ${NODES} ${OBJECTS} ${UTILS})

# build for videopipe
add_library(${PROJECT_NAME} SHARED ${VP_CPPS_SOURCES})
target_link_libraries(${PROJECT_NAME} ${VP_DEPEND_LIBS})
target_link_libraries(${PROJECT_NAME} PUBLIC ${VP_DEPEND_LIBS})
target_link_directories(${PROJECT_NAME} PUBLIC "D:\\Works\\github\\vcpkg\\installed\\x64-windows\\lib")


target_link_libraries(${PROJECT_NAME} PUBLIC unofficial::tinyexpr::tinyexpr)
target_compile_options(${PROJECT_NAME} PRIVATE /MP)

# build for samples
add_subdirectory(samples)
15 changes: 15 additions & 0 deletions CMakeSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"configurations": [
{
"name": "x64-Debug",
"generator": "Ninja",
"configurationType": "Debug",
"inheritEnvironments": [ "msvc_x64_x64" ],
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": ""
}
]
}
6 changes: 3 additions & 3 deletions nodes/osd/vp_cluster_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@ namespace vp_nodes {
auto D = cache_high_features[0].second.size(); // all the same as the first feature's dims

// prepare input
double data[N * D];
double Y[N * no_dims];
std::vector<double> data(N * D);
std::vector<double> Y(N * no_dims);
for (int i = 0; i < N; i++) {
for (int j = 0; j < D; j++) {
data[i * D + j] = cache_high_features[i].second[j];
}
}

// call t-SNE
TSNE::run(data, N, D, Y, no_dims, perplexity, theta, rand_seed, skip_random_init, max_iter, stop_lying_iter, mom_switch_iter);
TSNE::run(data.data(), N, D, Y.data(), no_dims, perplexity, theta, rand_seed, skip_random_init, max_iter, stop_lying_iter, mom_switch_iter);

// prepare output
for (int i = 0; i < N; i++) {
Expand Down
2 changes: 1 addition & 1 deletion nodes/osd/vp_expr_osd_node.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@


#include <opencv2/imgproc.hpp>
#include "vp_expr_osd_node.h"
#include "../../utils/vp_utils.h"
Expand Down
2 changes: 1 addition & 1 deletion nodes/osd/vp_plate_osd_node.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#pragma once
#pragma once

#include <opencv2/freetype.hpp>

Expand Down
2 changes: 1 addition & 1 deletion nodes/proc/vp_expr_check_node.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

#include "vp_expr_check_node.h"
#include "../../third_party/tinyexpr/tinyexpr.h"
#include "tinyexpr.h"

namespace vp_nodes {

Expand Down
24 changes: 12 additions & 12 deletions nodes/record/vp_record_task.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,19 @@ namespace vp_nodes {
}

// check save dir
if (!std::experimental::filesystem::exists(save_dir)) {
if (!std::filesystem::exists(save_dir)) {
VP_INFO(vp_utils::string_format("[%s] [record] save dir not exists, now creating save dir: `%s`", host_node_name.c_str(), save_dir.c_str()));
std::experimental::filesystem::create_directories(save_dir);
std::filesystem::create_directories(save_dir);
}

// do not generate sub folder
if (!auto_sub_dir) {
std::experimental::filesystem::path p1(save_dir);
std::experimental::filesystem::path p2(file_name_without_ext + get_file_ext());
std::filesystem::path p1(save_dir);
std::filesystem::path p2(file_name_without_ext + get_file_ext());

// ./video/abc.mp4
auto p = p1 / p2;
if (std::experimental::filesystem::exists(p)) {
if (std::filesystem::exists(p)) {
// just check once
auto new_file_name = file_name_without_ext + "_" + std::to_string(NOW.time_since_epoch().count()) + get_file_ext();
VP_WARN(vp_utils::string_format("[%s] [record] `%s` already exists, changing to: `%s`", host_node_name.c_str(), p2.string().c_str(), new_file_name.c_str()));
Expand All @@ -60,21 +60,21 @@ namespace vp_nodes {
}
else {
// generate sub folder by date and channel
std::experimental::filesystem::path p1(save_dir);
std::filesystem::path p1(save_dir);
// just use year-mon-day
std::experimental::filesystem::path p2(vp_utils::time_format(std::chrono::system_clock::now(), "<year>-<mon>-<day>"));
std::experimental::filesystem::path p3(std::to_string(channel_index));
std::experimental::filesystem::path p4(file_name_without_ext + get_file_ext());
std::filesystem::path p2(vp_utils::time_format(std::chrono::system_clock::now(), "<year>-<mon>-<day>"));
std::filesystem::path p3(std::to_string(channel_index));
std::filesystem::path p4(file_name_without_ext + get_file_ext());

auto p1_3 = p1 / p2 / p3;
if (!std::experimental::filesystem::exists(p1_3)) {
if (!std::filesystem::exists(p1_3)) {
VP_INFO(vp_utils::string_format("[%s] [record] sub dir not exists, now creating sub dir: `%s`", host_node_name.c_str(), p1_3.string().c_str()));
std::experimental::filesystem::create_directories(p1_3);
std::filesystem::create_directories(p1_3);
}

// ./video/2022-10-10/1/abc.mp4
auto p = p1_3 / p4;
if (std::experimental::filesystem::exists(p)) {
if (std::filesystem::exists(p)) {
// just check once
auto new_file_name = file_name_without_ext + "_" + std::to_string(NOW.time_since_epoch().count()) + get_file_ext();
VP_WARN(vp_utils::string_format("[%s] [record] `%s` already exists, changing to: `%s`", host_node_name.c_str(), p4.string().c_str(), new_file_name.c_str()));
Expand Down
2 changes: 1 addition & 1 deletion nodes/record/vp_record_task.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <functional>
// compile tips:
// remove experimental/ if gcc >= 8.0
#include <experimental/filesystem>
#include <filesystem>
#include <opencv2/core.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/videoio.hpp>
Expand Down
Loading