Commit 95d57f8c authored by carbon's avatar carbon

add AI Demo for Duo

parent 326b1882
#!/bin/sh
# Camera I2C init
/usr/bin/cvi_pinmux -w PAD_MIPIRX1P/IIC1_SDA
/usr/bin/cvi_pinmux -w PAD_MIPIRX0N/IIC1_SCL
sleep 1
#DEFAULT_HOST="192.168.1.3"
echo 16777216 > /proc/sys/net/core/wmem_max
echo "4096 873800 16777216" > /proc/sys/net/ipv4/tcp_wmem
echo "3073344 4097792 16777216" > /proc/sys/net/ipv4/tcp_mem
if [ "$1" == "64M" ]; then
CFG_JSON_FILE="./cfg_64M.json"
elif [ "$1" == "128M" ]; then
CFG_JSON_FILE="./cfg_128M.json"
else
echo "Please input size of RAM!"
echo "e.g. ./CviIspTool.sh 64M"
exit 0
fi
if [ -z "$CVI_RTSP_JSON" ]; then
export CVI_RTSP_JSON=$CFG_JSON_FILE
fi
getopts_get_optional_argument() {
eval next_token=\${$OPTIND}
if [[ -n $next_token && $next_token != -* ]]; then
OPTIND=$((OPTIND + 1))
OPTARG=$next_token
else
OPTARG=""
fi
}
# $1 is used, $2 shift to $1
shift
sed -i 's/"dev-num": 2/"dev-num": 1/g' $CFG_JSON_FILE
while getopts "hgmi" OPTION; do
case $OPTION in
i)
getopts_get_optional_argument $@
if [ -z "$OPTARG" ]; then
HOST=${DEFAULT_HOST}
else
HOST=$OPTARG
fi
echo "set the IP address $HOST to network interface"
;;
g)
GIGABIT="true"
echo "use gigabit ethernet"
;;
m)
if [ -z "$CVI_RTSP_MODE" ]; then
export CVI_RTSP_MODE=1
fi
echo "use multi rtsp server"
sed -i 's/"dev-num": 1/"dev-num": 2/g' $CFG_JSON_FILE
;;
h)
echo "Usage:"
echo " -i set the IP address to network interface"
echo " -g use gigabit ethernet"
echo " -m use multi rtsp server"
echo " -h help (this output)"
exit 0
;;
esac
done
# disable vcodec debug message to minize latency
if [ -d "/sys/module/cv181x_vcodec/" ];then
echo 0x20001 > /sys/module/cv181x_vcodec/parameters/vcodec_mask
elif [ -d "/sys/module/cv180x_vcodec/" ];then
echo 0x20001 > /sys/module/cv180x_vcodec/parameters/vcodec_mask
fi
# enable remap
echo 1 > /sys/module/cvi_vc_driver/parameters/addrRemapEn
echo 256 > /sys/module/cvi_vc_driver/parameters/ARExtraLine
#if [ "$HOST" ]; then
# if [ "$GIGABIT" == "true" ]; then
# # enable gigabit ethernet (=eth1)
# ifconfig eth0 down
# ifconfig eth1 up
# ifconfig eth1 $HOST netmask 255.255.255.0
# #udhcpc -b -i eth1 -R & # unmakr this line to use DHCP
# else
# ifconfig eth1 down
# ifconfig eth0 up
# ifconfig eth0 $HOST netmask 255.255.255.0
# #udhcpc -b -i eth1 -R & # unmark this line to use DHCP
# fi
#fi
# for eaier debugging, add $PWD to LD_LIBRARY_PATH and PATH
SCRIPT_SELF=$(cd "$(dirname "$0")"; pwd)
export LD_LIBRARY_PATH=${SCRIPT_SELF}/lib:/mnt/system/lib:${LD_LIBRARY_PATH}
PATH=${SCRIPT_SELF}:/mnt/system/usr/bin:$PATH
cd ${SCRIPT_SELF}
isp_tool_daemon
{
"//": "-----------------------------------------------------------------------------------------------------------------------------------------------------",
"//": "more option please refer https://cvitekcn-my.sharepoint.com/:x:/g/personal/tjyoung_cvitek_com/EavTSnA63CNAl2ZXmKwZnaoBK45WzoKdsrEQ7gwXNxKOpQ?e=l3hgB8",
"//": "-----------------------------------------------------------------------------------------------------------------------------------------------------",
"//": "compress-mode none,tile,line,frame",
"//": "if run AI(face ae) function, make buf1-blk-cnt 4 please!",
"//": "we set venc-bind-vpss=1 can cost down vb blk",
"//": "bitstream-buf-size can set venc buffer size",
"//": "vi-vpss-mode 0.VI_OFFLINE_VPSS_OFFLINE 1.VI_OFFLINE_VPSS_ONLINE",
"//": "vi-vpss-mode 2.VI_ONLINE_VPSS_OFFLINE 3.VI_ONLINE_VPSS_ONLINE",
"//": "when it is wdr mode or dual sensor, we cant't set VI_ONLINE_VPSS_OFFLINE/VI_ONLINE_VPSS_ONLINE",
"//": "devNum decides whether to run oneRtspServer or dualRtspServer",
"//": "devNum=1 dualSensor use the same video-src-info chn0 settings",
"//": "if run sbm mode, set vi-vpss-mode 1 set venc-bind-vpss true",
"dev-num": 1,
"rtsp-port": 8554,
"buf1-blk-cnt": 0,
"vi-vpss-mode": 1,
"model": "./cvi_models/retinaface_mnet0.25_342_608.cvimodel",
"sbm": 0,
"sbm-buf-line": 64,
"sbm-buf-size": 16,
"video-src-info": [
{
"chn": 0,
"buf-blk-cnt": 2,
"venc-bind-vpss": false,
"enable-isp-info-osd": false,
"enable-retinaface": false,
"venc_json": "./vc_param_128M.json",
"codec": "265",
"gop": 50,
"bitrate": 5000,
"compress-mode": "tile"
},
{
"chn": 1,
"buf-blk-cnt": 5,
"venc-bind-vpss": false,
"enable-isp-info-osd": false,
"enable-retinaface": false,
"venc_json": "/mnt/data/vc_param.json",
"codec": "265",
"gop": 50,
"bitrate": 5000,
"compress-mode": "tile"
}
]
}
{
"//": "-----------------------------------------------------------------------------------------------------------------------------------------------------",
"//": "more option please refer https://cvitekcn-my.sharepoint.com/:x:/g/personal/tjyoung_cvitek_com/EavTSnA63CNAl2ZXmKwZnaoBK45WzoKdsrEQ7gwXNxKOpQ?e=l3hgB8",
"//": "-----------------------------------------------------------------------------------------------------------------------------------------------------",
"//": "compress-mode none,tile,line,frame",
"//": "if run AI(face ae) function, make buf1-blk-cnt 4 please!",
"//": "we set venc-bind-vpss=1 can cost down vb blk",
"//": "bitstream-buf-size can set venc buffer size",
"//": "vi-vpss-mode 0.VI_OFFLINE_VPSS_OFFLINE 1.VI_OFFLINE_VPSS_ONLINE",
"//": "vi-vpss-mode 2.VI_ONLINE_VPSS_OFFLINE 3.VI_ONLINE_VPSS_ONLINE",
"//": "when it is wdr mode or dual sensor, we cant't set VI_ONLINE_VPSS_OFFLINE/VI_ONLINE_VPSS_ONLINE",
"//": "devNum decides whether to run oneRtspServer or dualRtspServer",
"//": "devNum=1 dualSensor use the same video-src-info chn0 settings",
"//": "if run sbm mode, set vi-vpss-mode 1 set venc-bind-vpss true",
"dev-num": 1,
"rtsp-port": 8554,
"buf1-blk-cnt": 0,
"vi-vpss-mode": 1,
"model": "./cvi_models/retinaface_mnet0.25_342_608.cvimodel",
"sbm": 0,
"sbm-buf-line": 64,
"sbm-buf-size": 16,
"video-src-info": [
{
"chn": 0,
"buf-blk-cnt": 5,
"venc-bind-vpss": false,
"enable-isp-info-osd": false,
"enable-retinaface": false,
"venc_json": "./vc_param_64M.json",
"codec": "265",
"gop": 50,
"bitrate": 2000,
"compress-mode": "tile",
"rc-mode": 0,
"bitstream-buf-size": 524288
},
{
"chn": 1,
"buf-blk-cnt": 5,
"venc-bind-vpss": false,
"enable-isp-info-osd": false,
"enable-retinaface": false,
"venc_json": "/mnt/data/vc_param.json",
"codec": "265",
"gop": 50,
"bitrate": 5000,
"compress-mode": "tile"
}
]
}
{
"Coding Param": {
"items": [
{
"key": "FrmLostOpen",
"optype": "Manual",
"value": 0,
"value_type": "int"
},
{
"key": "LostMode",
"optype": "Manual",
"value": 1,
"value_type": "int"
},
{
"key": "FrmLostBpsThr",
"optype": "Manual",
"value": 0,
"value_type": "int"
},
{
"key": "EncFrmGaps",
"optype": "Manual",
"value": 0,
"value_type": "int"
},
{
"key": "IntraCost",
"optype": "Manual",
"value": 0,
"value_type": "int"
},
{
"key": "aspectRatioInfoPresentFlag",
"optype": "Manual",
"value": 0,
"value_type": "int"
},
{
"key": "overscanInfoPresentFlag",
"optype": "Manual",
"value": 0,
"value_type": "int"
},
{
"key": "videoSignalTypePresentFlag",
"optype": "Manual",
"value": 1,
"value_type": "int"
},
{
"key": "videoFormat",
"optype": "Manual",
"value": 5,
"value_type": "int"
},
{
"key": "videoFullRangeFlag",
"optype": "Manual",
"value": 1,
"value_type": "int"
},
{
"key": "colourDescriptionPresentFlag",
"optype": "Manual",
"value": 0,
"value_type": "int"
},
{
"key": "ChromaQpOffset",
"optype": "Manual",
"value": -6,
"value_type": "int"
},
{
"key": "CbQpOffset",
"optype": "Manual",
"value": -6,
"value_type": "int"
},
{
"key": "CrQpOffset",
"optype": "Manual",
"value": -6,
"value_type": "int"
}
],
"module": "Coding Param",
"optype": "Manual"
},
"Gop Mode": {
"items": [
{
"key": "GopMode",
"optype": "Manual",
"value": 0,
"value_type": "int"
},
{
"key": "IPQpDelta",
"optype": "Manual",
"value": 2,
"value_type": "int"
},
{
"key": "BgInterval",
"optype": "Manual",
"value": 250,
"value_type": "int"
},
{
"key": "BgQpDelta",
"optype": "Manual",
"value": 0,
"value_type": "int"
},
{
"key": "ViQpDelta",
"optype": "Manual",
"value": 0,
"value_type": "int"
}
],
"module": "Gop Mode",
"optype": "Manual"
},
"RC Attr": {
"items": [
{
"key": "RcMode",
"optype": "Manual",
"value": 0,
"value_type": "int"
},
{
"key": "Gop",
"optype": "Manual",
"value": 50,
"value_type": "int"
},
{
"key": "VariableFPS",
"optype": "Manual",
"value": 0,
"value_type": "int"
},
{
"key": "SrcFrmRate",
"optype": "Manual",
"value": 25,
"value_type": "int"
},
{
"key": "DstFrmRate",
"optype": "Manual",
"value": 25,
"value_type": "int"
},
{
"key": "StatTime",
"optype": "Manual",
"value": 2,
"value_type": "int"
},
{
"key": "BitRate",
"optype": "Manual",
"value": 4096,
"value_type": "int"
},
{
"key": "MaxBitrate",
"optype": "Manual",
"value": 2000,
"value_type": "int"
},
{
"key": "IQP",
"optype": "Manual",
"value": 38,
"value_type": "int"
},
{
"key": "PQP",
"optype": "Manual",
"value": 38,
"value_type": "int"
}
],
"module": "RC Attr",
"optype": "Manual"
},
"RC Param": {
"items": [
{
"key": "ThrdLv",
"optype": "Manual",
"value": 2,
"value_type": "int"
},
{
"key": "FirstFrameStartQp",
"optype": "Manual",
"value": 32,
"value_type": "int"
},
{
"key": "InitialDelay",
"optype": "Manual",
"value": 1000,
"value_type": "int"
},
{
"key": "MaxQp",
"optype": "Manual",
"value": 51,
"value_type": "int"
},
{
"key": "MinQp",
"optype": "Manual",
"value": 20,
"value_type": "int"
},
{
"key": "MaxIQp",
"optype": "Manual",
"value": 51,
"value_type": "int"
},
{
"key": "MinIQp",
"optype": "Manual",
"value": 20,
"value_type": "int"
},
{
"key": "ChangePos",
"optype": "Manual",
"value": 90,
"value_type": "int"
},
{
"key": "MinStillPercent",
"optype": "Manual",
"value": 10,
"value_type": "int"
},
{
"key": "MaxStillQP",
"optype": "Manual",
"value": 31,
"value_type": "int"
},
{
"key": "MotionSensitivity",
"optype": "Manual",
"value": 24,
"value_type": "int"
},
{
"key": "PureStillThr",
"optype": "Manual",
"value": 4,
"value_type": "int"
},
{
"key": "AvbrFrmLostOpen",
"optype": "Manual",
"value": 0,
"value_type": "int"
},
{
"key": "AvbrFrmGap",
"optype": "Manual",
"value": 1,
"value_type": "int"
}
],
"module": "RC Param",
"optype": "Manual"
}
}
{
"Coding Param": {
"items": [
{
"key": "FrmLostOpen",
"optype": "Manual",
"value": 0,
"value_type": "int"
},
{
"key": "LostMode",
"optype": "Manual",
"value": 1,
"value_type": "int"
},
{
"key": "FrmLostBpsThr",
"optype": "Manual",
"value": 0,
"value_type": "int"
},
{
"key": "EncFrmGaps",
"optype": "Manual",
"value": 0,
"value_type": "int"
},
{
"key": "IntraCost",
"optype": "Manual",
"value": 0,
"value_type": "int"
}
],
"module": "Coding Param",
"optype": "Manual"
},
"Gop Mode": {
"items": [
{
"key": "GopMode",
"optype": "Manual",
"value": 0,
"value_type": "int"
},
{
"key": "IPQpDelta",
"optype": "Manual",
"value": 2,
"value_type": "int"
},
{
"key": "BgInterval",
"optype": "Manual",
"value": 250,
"value_type": "int"
},
{
"key": "BgQpDelta",
"optype": "Manual",
"value": 0,
"value_type": "int"
},
{
"key": "ViQpDelta",
"optype": "Manual",
"value": 0,
"value_type": "int"
}
],
"module": "Gop Mode",
"optype": "Manual"
},
"RC Attr": {
"items": [
{
"key": "RcMode",
"optype": "Manual",
"value": 0,
"value_type": "int"
},
{
"key": "Gop",
"optype": "Manual",
"value": 50,
"value_type": "int"
},
{
"key": "VariableFPS",
"optype": "Manual",
"value": 1,
"value_type": "int"
},
{
"key": "SrcFrmRate",
"optype": "Manual",
"value": 25,
"value_type": "int"
},
{
"key": "DstFrmRate",
"optype": "Manual",
"value": 25,
"value_type": "int"
},
{
"key": "StatTime",
"optype": "Manual",
"value": 2,
"value_type": "int"
},
{
"key": "BitRate",
"optype": "Manual",
"value": 1000,
"value_type": "int"
},
{
"key": "MaxBitrate",
"optype": "Manual",
"value": 8192,
"value_type": "int"
},
{
"key": "IQP",
"optype": "Manual",
"value": 38,
"value_type": "int"
},
{
"key": "PQP",
"optype": "Manual",
"value": 38,
"value_type": "int"
}
],
"module": "RC Attr",
"optype": "Manual"
},
"RC Param": {
"items": [
{
"key": "ThrdLv",
"optype": "Manual",
"value": 2,
"value_type": "int"
},
{
"key": "FirstFrameStartQp",
"optype": "Manual",
"value": 34,
"value_type": "int"
},
{
"key": "InitialDelay",
"optype": "Manual",
"value": 1000,
"value_type": "int"
},
{
"key": "MaxQp",
"optype": "Manual",
"value": 51,
"value_type": "int"
},
{
"key": "MinQp",
"optype": "Manual",
"value": 20,
"value_type": "int"
},
{
"key": "MaxIprop",
"optype": "Manual",
"value": 10,
"value_type": "int"
},
{
"key": "MaxIQp",
"optype": "Manual",
"value": 51,
"value_type": "int"
},
{
"key": "MinIQp",
"optype": "Manual",
"value": 20,
"value_type": "int"
},
{
"key": "ChangePos",
"optype": "Manual",
"value": 90,
"value_type": "int"
},
{
"key": "MinStillPercent",
"optype": "Manual",
"value": 20,
"value_type": "int"
},
{
"key": "MaxStillQP",
"optype": "Manual",
"value": 38,
"value_type": "int"
},
{
"key": "MotionSensitivity",
"optype": "Manual",
"value": 24,
"value_type": "int"
},
{
"key": "PureStillThr",
"optype": "Manual",
"value": 4,
"value_type": "int"
},
{
"key": "AvbrFrmLostOpen",
"optype": "Manual",
"value": 0,
"value_type": "int"
},
{
"key": "AvbrFrmGap",
"optype": "Manual",
"value": 1,
"value_type": "int"
}
],
"module": "RC Param",
"optype": "Manual"
}
}
\ No newline at end of file
#!/bin/sh #!/bin/sh
cd /mnt/data/camera-test/ export LD_LIBRARY_PATH=/mnt/system/lib
sample_vi_fd /mnt/cvimodel/scrfd_480_270_int8.cvimodel
./CviIspTool.sh 64M
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment