Skip to content

Commit 39dfd89

Browse files
committed
update
1 parent 6c9a897 commit 39dfd89

9 files changed

Lines changed: 510 additions & 53 deletions

File tree

CMakeLists.txt

Lines changed: 88 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,103 @@
1-
cmake_minimum_required(VERSION 3.14)
1+
cmake_minimum_required(VERSION 3.16)
2+
project(shotgun CXX)
23

3-
project(shutoh VERSION 0.1)
4+
include(FetchContent)
45

5-
set(CMAKE_CXX_STANDARD 20)
6-
set(CMAKE_CXX_STANDARD_REQUIRED True)
7-
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
8-
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
6+
set(CMAKE_CXX_STANDARD 17)
97

10-
include(FetchContent)
11-
FetchContent_Declare(
12-
argparse
13-
GIT_REPOSITORY https://github.com/p-ranav/argparse.git
8+
# use onnxruntime 1.20.1
9+
if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
10+
set(ORT_URL "https://github.com/microsoft/onnxruntime/releases/download/v1.20.1/onnxruntime-linux-x64-1.20.1.tgz")
11+
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64")
12+
set(ORT_URL "https://github.com/microsoft/onnxruntime/releases/download/v1.20.1/onnxruntime-osx-arm64-1.20.1.tgz")
13+
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
14+
set(ORT_URL "https://github.com/microsoft/onnxruntime/releases/download/v1.20.1/onnxruntime-osx-x86_64-1.20.1.tgz")
15+
else()
16+
message(FATAL_ERROR "Unsupported platform: ${CMAKE_SYSTEM_NAME} ${CMAKE_SYSTEM_PROCESSOR}")
17+
endif()
18+
19+
FetchContent_Declare(onnxruntime URL ${ORT_URL})
20+
FetchContent_MakeAvailable(onnxruntime)
21+
22+
add_executable(shotgun
23+
src/main.cpp
24+
src/transnetv2.cpp
1425
)
15-
FetchContent_MakeAvailable(argparse)
1626

17-
include(FetchContent)
18-
FetchContent_Declare(
19-
pybind11
20-
GIT_REPOSITORY https://github.com/pybind/pybind11.git
21-
GIT_TAG v2.11.1
27+
target_include_directories(shotgun PRIVATE
28+
include/
29+
${onnxruntime_SOURCE_DIR}/include
30+
)
31+
32+
target_link_directories(shotgun PRIVATE
33+
${onnxruntime_SOURCE_DIR}/lib
34+
)
35+
36+
target_link_libraries(shotgun PRIVATE
37+
onnxruntime
2238
)
23-
FetchContent_MakeAvailable(pybind11)
2439

25-
find_package(OpenCV REQUIRED)
26-
find_package(fmt REQUIRED)
27-
find_package(Python3 REQUIRED COMPONENTS Interpreter Development)
40+
41+
#cmake_minimum_required(VERSION 3.14)
42+
43+
#project(shutoh VERSION 0.1)
44+
45+
#set(CMAKE_CXX_STANDARD 20)
46+
#set(CMAKE_CXX_STANDARD_REQUIRED True)
47+
#set(CMAKE_POSITION_INDEPENDENT_CODE ON)
48+
#set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
49+
50+
#include(FetchContent)
51+
#FetchContent_Declare(
52+
# argparse
53+
# GIT_REPOSITORY https://github.com/p-ranav/argparse.git
54+
#)
55+
#FetchContent_MakeAvailable(argparse)
56+
57+
#include(FetchContent)
58+
#FetchContent_Declare(
59+
# pybind11
60+
# GIT_REPOSITORY https://github.com/pybind/pybind11.git
61+
# GIT_TAG v2.11.1
62+
#)
63+
#FetchContent_MakeAvailable(pybind11)
64+
65+
#find_package(OpenCV REQUIRED)
66+
#find_package(fmt REQUIRED)
67+
#find_package(Python3 REQUIRED COMPONENTS Interpreter Development)
2868

2969
# Library
30-
if (EXISTS "${CMAKE_SOURCE_DIR}/src")
31-
file(GLOB LIB_SOURCES
32-
"${CMAKE_SOURCE_DIR}/src/*.cpp"
33-
"${CMAKE_SOURCE_DIR}/src/detector/*.cpp"
34-
"${CMAKE_SOURCE_DIR}/src/bindings/*.cpp")
35-
else()
36-
FetchContent_MakeAvailable(shutoh)
37-
file(GLOB LIB_SOURCES
38-
"${shutoh_SOURCE_DIR}/src/*.cpp"
39-
"${shutoh_SOURCE_DIR}/src/detector/*.cpp"
40-
"${shutoh_SOURCE_DIR}/src/bindings/*.cpp"
41-
)
42-
set(SKIP_TESTS TRUE)
43-
endif()
44-
add_library(shutoh SHARED ${LIB_SOURCES})
45-
target_compile_options(shutoh PRIVATE -O3 -Wall)
46-
target_include_directories(shutoh PUBLIC include ${OpenCV_INCLUDE_DIRS} ${Python3_INCLUDE_DIRS})
47-
target_link_libraries(shutoh PUBLIC ${OpenCV_LIBS} fmt::fmt argparse pybind11::module ${Python3_LIBRARIES})
70+
#if (EXISTS "${CMAKE_SOURCE_DIR}/src")
71+
# file(GLOB LIB_SOURCES
72+
# "${CMAKE_SOURCE_DIR}/src/*.cpp"
73+
# "${CMAKE_SOURCE_DIR}/src/detector/*.cpp"
74+
# "${CMAKE_SOURCE_DIR}/src/bindings/*.cpp")
75+
#else()
76+
# FetchContent_MakeAvailable(shutoh)
77+
# file(GLOB LIB_SOURCES
78+
# "${shutoh_SOURCE_DIR}/src/*.cpp"
79+
# "${shutoh_SOURCE_DIR}/src/detector/*.cpp"
80+
# "${shutoh_SOURCE_DIR}/src/bindings/*.cpp"
81+
# )
82+
# set(SKIP_TESTS TRUE)
83+
#endif()
84+
#add_library(shutoh SHARED ${LIB_SOURCES})
85+
#target_compile_options(shutoh PRIVATE -O3 -Wall)
86+
#target_include_directories(shutoh PUBLIC include ${OpenCV_INCLUDE_DIRS} ${Python3_INCLUDE_DIRS})
87+
#target_link_libraries(shutoh PUBLIC ${OpenCV_LIBS} fmt::fmt argparse pybind11::module ${Python3_LIBRARIES})
4888

4989
# CLI
50-
add_executable(shutoh_cli src/main.cpp)
51-
set_target_properties(shutoh_cli PROPERTIES OUTPUT_NAME "shutoh")
52-
target_link_libraries(shutoh_cli PRIVATE shutoh)
90+
#add_executable(shutoh_cli src/main.cpp)
91+
#set_target_properties(shutoh_cli PROPERTIES OUTPUT_NAME "shutoh")
92+
#target_link_libraries(shutoh_cli PRIVATE shutoh)
5393

5494
# Tests
55-
if (NOT SKIP_TESTS)
56-
enable_testing()
57-
add_subdirectory(tests)
95+
#if (NOT SKIP_TESTS)
96+
# enable_testing()
97+
# add_subdirectory(tests)
5898

5999
# Install
60-
install(TARGETS shutoh DESTINATION lib)
61-
install(TARGETS shutoh_cli DESTINATION bin)
62-
install(DIRECTORY include/ DESTINATION include)
63-
endif()
100+
# install(TARGETS shutoh DESTINATION lib)
101+
#install(TARGETS shutoh_cli DESTINATION bin)
102+
#install(DIRECTORY include/ DESTINATION include)
103+
#endif()

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
# Shutoh
1+
# Shotgun
22

3-
[![Build](https://github.com/awkrail/shutoh/actions/workflows/build.yml/badge.svg)](https://github.com/awkrail/shutoh/actions/workflows/build.yml)
4-
[![Python build](https://github.com/awkrail/shutoh/actions/workflows/python-build.yml/badge.svg)](https://github.com/awkrail/shutoh/actions/workflows/python-build.yml)
5-
[![MIT License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](LICENSE)
3+
## Now under construction, the following README is outdated. Stay tuned!!
64

75
Shutoh (手刀, meaning karate chop in Japanese) is a fast and efficient scene detection tool implemented in C++20.
86
Inspired by [PySceneDetect](https://github.com/Breakthrough/PySceneDetect), Shutoh aims to provide a powerful and flexible alternative with enhanced performance. The key features of Shutoh is threefold:

include/transnetv2.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#pragma once
2+
#include <string>
3+
#include <vector>
4+
#include <onnxruntime_cxx_api.h>
5+
6+
class TransNetV2 {
7+
public:
8+
explicit TransNetV2(const std::string& model_path);
9+
// frames: [T, 27, 48, 3] uint8
10+
std::vector<float> predict(const std::vector<uint8_t>& frames, int T);
11+
12+
private:
13+
Ort::Env env_;
14+
Ort::Session session_;
15+
Ort::MemoryInfo memory_info_;
16+
};

0 commit comments

Comments
 (0)