Merge pull request #47 from FantasyGmm/develop

在br中添加了ncnn与cmatrix的包,配置文件新增一些常用的工具
This commit is contained in:
Carbon
2024-01-08 01:50:29 +00:00
committed by GitHub
29 changed files with 246 additions and 1 deletions

1
build/.gitignore vendored
View File

@ -4,6 +4,7 @@
config.cmake
*.pyc
.config.old
br.log
# ignore dirs

View File

@ -581,7 +581,7 @@ br-rootfs-pack:export TARGET_OUTPUT_DIR=$(BR_DIR)/output/$(BR_BOARD)
br-rootfs-pack:
$(call print_target)
${Q}$(MAKE) -C $(BR_DIR) $(BR_DEFCONFIG) BR2_TOOLCHAIN_EXTERNAL_PATH=$(CROSS_COMPILE_PATH)
${Q}$(MAKE) -j${NPROC} -C $(BR_DIR)
${Q}$(BR_DIR)/utils/brmake -j${NPROC} -C $(BR_DIR)
# ${Q}rm -rf $(BR_ROOTFS_DIR)/*
# copy rootfs to rawimg dir
${Q}cp $(TARGET_OUTPUT_DIR)/images/rootfs.ext4 $(OUTPUT_DIR)/rawimages/rootfs_ext4.$(STORAGE_TYPE)

View File

@ -487,3 +487,19 @@ BR2_PACKAGE_IPERF3=y
BR2_PACKAGE_NTP=y
BR2_PACKAGE_NTP_NTPDATE=y
BR2_PACKAGE_NTP_NTPTIME=y
BR2_PACKAGE_TREE=y
BR2_PACKAGE_BASH_LOADABLE_EXAMPLES=y
BR2_PACKAGE_BASH_COMPLETION=y
BR2_PACKAGE_FILE=y
BR2_PACKAGE_NEOFETCH=y
BR2_PACKAGE_NANO=y
BR2_PACKAGE_VIM=y
BR2_PACKAGE_NCURSES_WCHAR=y
#
# Custom Package
#
BR2_PACKAGE_NCNN=y
BR2_PACKAGE_NCNN_BENCH=y
BR2_PACKAGE_NCNN_EXAMPLE=y
BR2_PACKAGE_CMATRIX=y

View File

Binary file not shown.

View File

View File

Binary file not shown.

View File

Binary file not shown.

View File

Binary file not shown.

View File

Binary file not shown.

View File

Binary file not shown.

View File

Binary file not shown.

View File

Binary file not shown.

View File

@ -2529,4 +2529,9 @@ menu "Text editors and viewers"
source "package/vim/Config.in"
endmenu
menu "Custom Package"
source "package/ncnn/Config.in"
source "package/cmatrix/Config.in"
endmenu
endmenu

View File

@ -0,0 +1,8 @@
config BR2_PACKAGE_CMATRIX
bool "cmatrix"
depends on BR2_USE_WCHAR # ncurses wchar
select BR2_PACKAGE_NCURSES
select BR2_PACKAGE_NCURSES_WCHAR
default n
help
Terminal based "The Matrix" like implementation

View File

@ -0,0 +1,35 @@
###############################################################################
#
# Cmatrix
#
###############################################################################
CMATRIX_VERSION = 5c082c64a1296859a11bee60c8c086655953a416
CMATRIX_SITE = $(call github,abishekvashok,cmatrix,$(CMATRIX_VERSION))
CMATRIX_SITE_LICENSE = GNU GPL v3
CMATRIX_SITE_LICENSE_FILES = COPYING
CMATRIX_DEPENDENCIES = ncurses
CMATRIX_CFLAGS = $(TARGET_CFLAGS)
CMATRIX_LDFLAGS = $(TARGET_LDFLAGS) -lncursesw
CMATRIX_CFLAGS += -DHAVE_SETFONT
define CMATRIX_BUILD_CMDS
(cd $(@D); \
gunzip -c matrix.psf.gz > matrix.psf; \
autoreconf -i; \
./configure --host=$(BR2_TOOLCHAIN_EXTERNAL_PREFIX) CC=$(TARGET_CC) LD=$(TARGET_LD) --without-fonts; \
make \
CROSS_COMPILE=$(TARGET_CROSS) \
CFLAGS='$(CMATRIX_CFLAGS)' \
LDFLAGS='$(CMATRIX_LDFLAGS)' \
)
endef
define CMATRIX_INSTALL_TARGET_CMDS
$(INSTALL) -D -m 0755 $(@D)/cmatrix $(TARGET_DIR)/usr/bin/cmatrix
$(INSTALL) -D -m 0755 $(@D)/matrix.psf $(TARGET_DIR)/usr/share/fonts/matrix.psf
endef
$(eval $(generic-package))

View File

@ -0,0 +1,61 @@
From 6086a0293ae37579f02b8daf4da72cdc5d5b5278 Mon Sep 17 00:00:00 2001
From: FantasyGmm <16450052+FantasyGmm@users.noreply.github.com>
Date: Fri, 5 Jan 2024 02:07:25 +0000
Subject: [PATCH] Disable OOM models in benchncnn for SG2002
---
benchmark/benchncnn.cpp | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/benchmark/benchncnn.cpp b/benchmark/benchncnn.cpp
index 067415a..dc643c1 100644
--- a/benchmark/benchncnn.cpp
+++ b/benchmark/benchncnn.cpp
@@ -431,19 +431,19 @@ int main(int argc, char** argv)
benchmark("googlenet_int8", ncnn::Mat(224, 224, 3), opt);
- benchmark("resnet18", ncnn::Mat(224, 224, 3), opt);
+// benchmark("resnet18", ncnn::Mat(224, 224, 3), opt);
- benchmark("resnet18_int8", ncnn::Mat(224, 224, 3), opt);
+// benchmark("resnet18_int8", ncnn::Mat(224, 224, 3), opt);
- benchmark("alexnet", ncnn::Mat(227, 227, 3), opt);
+// benchmark("alexnet", ncnn::Mat(227, 227, 3), opt);
- benchmark("vgg16", ncnn::Mat(224, 224, 3), opt);
+// benchmark("vgg16", ncnn::Mat(224, 224, 3), opt);
- benchmark("vgg16_int8", ncnn::Mat(224, 224, 3), opt);
+// benchmark("vgg16_int8", ncnn::Mat(224, 224, 3), opt);
- benchmark("resnet50", ncnn::Mat(224, 224, 3), opt);
+// benchmark("resnet50", ncnn::Mat(224, 224, 3), opt);
- benchmark("resnet50_int8", ncnn::Mat(224, 224, 3), opt);
+// benchmark("resnet50_int8", ncnn::Mat(224, 224, 3), opt);
benchmark("squeezenet_ssd", ncnn::Mat(300, 300, 3), opt);
@@ -457,7 +457,7 @@ int main(int argc, char** argv)
benchmark("mobilenetv2_yolov3", ncnn::Mat(352, 352, 3), opt);
- benchmark("yolov4-tiny", ncnn::Mat(416, 416, 3), opt);
+// benchmark("yolov4-tiny", ncnn::Mat(416, 416, 3), opt);
benchmark("nanodet_m", ncnn::Mat(320, 320, 3), opt);
@@ -465,7 +465,7 @@ int main(int argc, char** argv)
benchmark("yolo-fastestv2", ncnn::Mat(352, 352, 3), opt);
- benchmark("vision_transformer", ncnn::Mat(384, 384, 3), opt);
+// benchmark("vision_transformer", ncnn::Mat(384, 384, 3), opt);
benchmark("FastestDet", ncnn::Mat(352, 352, 3), opt);
}
--
2.25.1

View File

@ -0,0 +1,20 @@
menuconfig BR2_PACKAGE_NCNN
bool "ncnn"
help
ncnn is a high-performance neural network inference framework optimized for the mobile platform
https://github.com/Tencent/ncnn
if BR2_PACKAGE_NCNN
config BR2_PACKAGE_NCNN_BENCH
bool "Enable benchncnn"
help
copy benchncnn to target
config BR2_PACKAGE_NCNN_EXAMPLE
bool "Enable ncnn example"
help
copy ncnn example to target
endif

View File

@ -0,0 +1,99 @@
################################################################################
#
# ncnn
#
################################################################################
NCNN_VERSION = 20240102
NCNN_SITE = $(call github,Tencent,ncnn,$(NCNN_VERSION))
NCNN_LICENSE = BSD 3-Clause License
NCNN_LICENSE_FILES = LICENSE.txt
NCNN_CFLAGS = $(TARGET_CFLAGS)
NCNN_CFLAGS += -static
NCNN_CXXFLAGS = $(TARGET_CXXFLAGS)
NCNN_CXXFLAGS += -static
NCNN_LDFLAGS = $(TARGET_LDFLAGS)
NCNN_CONF_OPTS = \
-DCMAKE_SYSTEM_NAME="Linux" \
-DCMAKE_SYSTEM_PROCESSOR="riscv64" \
-DC906=True
NCNN_CONF_OPTS += \
-DCMAKE_C_FLAGS="$(NCNN_CFLAGS)" \
-DCMAKE_CXX_FLAGS="$(NCNN_CXXFLAGS)" \
-DCMAKE_LD_FLAGS="$(NCNN_LDFLAGS)" \
-DCMAKE_BUILD_TYPE=release
NCNN_CONF_OPTS += \
-DNCNN_OPENMP=OFF \
-DNCNN_THREADS=OFF \
-DNCNN_RUNTIME_CPU=OFF \
-DNCNN_RVV=ON \
-DNCNN_SIMPLEOCV=ON \
-DNCNN_BUILD_TESTS=OFF
ifeq ($(BR2_PACKAGE_NCNN_BENCH),y)
NCNN_CONF_OPTS += -DNCNN_BUILD_BENCHMARK=ON
else
NCNN_CONF_OPTS += -DNCNN_BUILD_BENCHMARK=OFF
endif
ifeq ($(BR2_PACKAGE_NCNN_EXAMPLE),y)
NCNN_CONF_OPTS += -DNCNN_BUILD_EXAMPLES=ON
else
NCNN_CONF_OPTS += -DNCNN_BUILD_EXAMPLES=OFF
endif
define NCNN_CREAT_FOLDER
$(INSTALL) -d -m 0755 $(TARGET_DIR)/usr/local/share/ncnn
$(INSTALL) -d -m 0755 $(TARGET_DIR)/usr/local/share/ncnn/param
$(INSTALL) -d -m 0755 $(TARGET_DIR)/usr/local/share/ncnn/images
endef
define NCNN_COPY_EXAMPLE_FILES
$(INSTALL) -D -m 0755 $(@D)/examples/squeezenet $(TARGET_DIR)/usr/bin/ncnn-squeezenet
$(INSTALL) -D -m 0755 $(@D)/examples/squeezenet_c_api $(TARGET_DIR)/usr/bin/ncnn-squeezenet_c_api
$(INSTALL) -D -m 0755 $(@D)/examples/fasterrcnn $(TARGET_DIR)/usr/bin/ncnn-fasterrcnn
$(INSTALL) -D -m 0755 $(@D)/examples/rfcn $(TARGET_DIR)/usr/bin/ncnn-rfcn
$(INSTALL) -D -m 0755 $(@D)/examples/yolov2 $(TARGET_DIR)/usr/bin/ncnn-yolov2
$(INSTALL) -D -m 0755 $(@D)/examples/yolov3 $(TARGET_DIR)/usr/bin/ncnn-yolov3
$(INSTALL) -D -m 0755 $(@D)/examples/yolov5 $(TARGET_DIR)/usr/bin/ncnn-yolov5
$(INSTALL) -D -m 0755 $(@D)/examples/yolov5_pnnx $(TARGET_DIR)/usr/bin/ncnn-yolov5_pnnx
$(INSTALL) -D -m 0755 $(@D)/examples/yolov7_pnnx $(TARGET_DIR)/usr/bin/ncnn-yolov7_pnnx
$(INSTALL) -D -m 0755 $(@D)/examples/yolov7 $(TARGET_DIR)/usr/bin/ncnn-yolov7
$(INSTALL) -D -m 0755 $(@D)/examples/yolox $(TARGET_DIR)/usr/bin/ncnn-yolox
$(INSTALL) -D -m 0755 $(@D)/examples/mobilenetv2ssdlite $(TARGET_DIR)/usr/bin/ncnn-mobilenetv2ssdlite
$(INSTALL) -D -m 0755 $(@D)/examples/mobilenetssd $(TARGET_DIR)/usr/bin/ncnn-mobilenetssd
$(INSTALL) -D -m 0755 $(@D)/examples/squeezenetssd $(TARGET_DIR)/usr/bin/ncnn-squeezenetssd
$(INSTALL) -D -m 0755 $(@D)/examples/shufflenetv2 $(TARGET_DIR)/usr/bin/ncnn-shufflenetv2
$(INSTALL) -D -m 0755 $(@D)/examples/peleenetssd_seg $(TARGET_DIR)/usr/bin/ncnn-peleenetssd_seg
$(INSTALL) -D -m 0755 $(@D)/examples/simplepose $(TARGET_DIR)/usr/bin/ncnn-simplepose
$(INSTALL) -D -m 0755 $(@D)/examples/retinaface $(TARGET_DIR)/usr/bin/ncnn-retinaface
$(INSTALL) -D -m 0755 $(@D)/examples/yolact $(TARGET_DIR)/usr/bin/ncnn-yolact
$(INSTALL) -D -m 0755 $(@D)/examples/nanodet $(TARGET_DIR)/usr/bin/ncnn-nanodet
$(INSTALL) -D -m 0755 $(@D)/examples/nanodetplus_pnnx $(TARGET_DIR)/usr/bin/ncnn-nanodetplus_pnnx
$(INSTALL) -D -m 0755 $(@D)/examples/scrfd $(TARGET_DIR)/usr/bin/ncnn-scrfd
$(INSTALL) -D -m 0755 $(@D)/examples/scrfd_crowdhuman $(TARGET_DIR)/usr/bin/ncnn-scrfd_crowdhuman
$(INSTALL) -D -m 0755 $(@D)/images/* $(TARGET_DIR)/usr/local/share/ncnn/images
$(INSTALL) -D -m 0755 $(@D)/examples/*.param $(TARGET_DIR)/usr/local/share/ncnn/param
$(INSTALL) -D -m 0755 $(@D)/examples/*.bin $(TARGET_DIR)/usr/local/share/ncnn/param
endef
define NCNN_COPY_BENCH_FILES
$(INSTALL) -D -m 0755 $(@D)/benchmark/benchncnn $(TARGET_DIR)/usr/bin/benchncnn
$(INSTALL) -D -m 0755 $(@D)/benchmark/*.param $(TARGET_DIR)/usr/local/share/ncnn/param
endef
NCNN_POST_INSTALL_TARGET_HOOKS += NCNN_CREAT_FOLDER
ifeq ($(BR2_PACKAGE_NCNN_BENCH),y)
NCNN_POST_INSTALL_TARGET_HOOKS += NCNN_COPY_BENCH_FILES
endif
ifeq ($(BR2_PACKAGE_NCNN_EXAMPLE),y)
NCNN_POST_INSTALL_TARGET_HOOKS += NCNN_COPY_EXAMPLE_FILES
endif
$(eval $(cmake-package))