diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 603511b..7c5df52 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -13,17 +13,18 @@ jobs: - uses: actions/checkout@v3 with: path: fisher - - name: cache-opencv - id: cache-opencv + - name: cache-opencv-mobile + id: cache-opencv-mobile uses: actions/cache@v3 with: - path: opencv - key: opencv-4.6.0 - - name: opencv - if: steps.cache-opencv.outputs.cache-hit != 'true' + path: opencv-mobile + key: opencv-mobile-vs2019-v14 + - name: opencv-mobile + if: steps.cache-opencv-mobile.outputs.cache-hit != 'true' run: | - Invoke-WebRequest -Uri https://github.com/opencv/opencv/releases/download/4.6.0/opencv-4.6.0-vc14_vc15.exe -OutFile opencv-4.6.0-vc14_vc15.exe - 7z x ./opencv-4.6.0-vc14_vc15.exe + Invoke-WebRequest -Uri https://github.com/nihui/opencv-mobile/releases/download/v14/opencv-mobile-4.5.4-windows-vs2019.zip -OutFile opencv-mobile-4.5.4-windows-vs2019.zip + 7z x ./opencv-mobile-4.5.4-windows-vs2019.zip + mv opencv-mobile-4.5.4-windows-vs2019 opencv-mobile - name: cache-ncnn id: cache-ncnn uses: actions/cache@v3 diff --git a/README.md b/README.md index c7a4241..4f39d78 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,13 @@ ## 功能更新 Functional Update +#### 2022/9/4 + +- 修复了opencv-mobile写含bbox的图片时背景颜色错误的bug +- 调整网络参数 + + + #### 2022/8/26 - 初步适配须弥鱼类:更新了神经网络的结构与参数并进行初步测试,基本在须弥能够正常工作. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3848a50..76ad628 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,15 +1,18 @@ cmake_minimum_required(VERSION 3.4.1) set(CMAKE_CXX_STANDARD 17) -project(fisher VERSION 3.0.1) +project(fisher VERSION 3.0.2) option(RELEASE "change directories" OFF) if(NOT RELEASE) + set(OpenCV_DIR "../../opencv/build") # collecting data needs cv::imshow option(TEST "collect rod data" OFF) +else() + set(OpenCV_DIR "../../opencv-mobile/x64") endif() -set(OpenCV_DIR "../../opencv/build") + set(ncnn_INSTALL_DIR "../../ncnn/x64") set(ncnn_DIR "${ncnn_INSTALL_DIR}/lib/cmake/ncnn") set(ncnn_INCLUDE_DIR "${ncnn_INSTALL_DIR}/include") diff --git a/src/fishing.cpp b/src/fishing.cpp index 6fc44e5..39172b7 100644 --- a/src/fishing.cpp +++ b/src/fishing.cpp @@ -73,7 +73,14 @@ double colorDiff(const int refColor[], cv::Vec3b screenColor) { cv::Mat draw_bboxes(const cv::Mat &bgr, const std::vector &bboxes, object_rect effect_roi) { - cv::Mat image = bgr.clone(); + cv::Mat image; + +#ifdef RELEASE // opencv-mobile reverse RGB and BGR here, but I don't know why + cv::cvtColor(bgr, image, cv::COLOR_BGR2RGB); +#else + image = bgr.clone(); +#endif + int src_w = image.cols; int src_h = image.rows; int dst_w = effect_roi.width; diff --git a/src/fishing.h b/src/fishing.h index 0fc5a1c..dfb493c 100644 --- a/src/fishing.h +++ b/src/fishing.h @@ -46,7 +46,7 @@ class Fisher { // unit: second const double MaxThrowWaiting = 3; const double MaxBiteWaiting[FISH_CLASS_NUM] = { - 6, 8.5, 9.5, 10.5, 7, 10.5, 10, 10, 9, 8}; // index is fish label + 8, 8.5, 9.5, 10.5, 8.5, 11.5, 11.5, 10.5, 9.5, 8.5}; // index is fish label const double MaxControlWaiting = 3; cv::Mat hookImg, pullImg, centralBarImg, leftEdgeImg, cursorImg, rightEdgeImg; diff --git a/src/rodnet.cpp b/src/rodnet.cpp index 4a132b0..0459139 100644 --- a/src/rodnet.cpp +++ b/src/rodnet.cpp @@ -3,29 +3,29 @@ const double alpha = 1734.34 / 2.5; // tangent per pixel of nanodet input screen -const double dz[FISH_CLASS_NUM] = {0.694767486335, 0.705337270051, - 0.686332216768, 1.220813102738, - 1.094953763608, 1.075469787444, - 0.816349156903, 0.805647715939, - 0.580136160296, 0.717789275813}, +const double dz[FISH_CLASS_NUM] = {0.593837091544, 0.638617811728, + 0.686516414917, 1.101028742227, + 1.045381575449, 1.092016629866, + 0.910938338224, 1.537756036204, + 0.795793167906, 1.009537510317}, theta[3][1 + FISH_CLASS_NUM] = - {{-0.063321387830, 0.271287522041, -0.289622288023, - 0.369747102726, -0.382151700443, -0.209881378546, - 0.216269445203, 0.047319592279, -0.336408813103, - 0.472667978506, 0.063048934754}, - {-0.409084259711, -0.435680067346, -0.021881190130, - -0.029230749790, 0.452849262476, -0.152770124847, - 0.483840163995, 0.375548149249, 0.430277401509, - -0.083056601200, 0.402188636327}, - {0.432541882301, 0.189117922865, 0.348296203478, - -0.046222606584, 0.068145706124, 0.057344159790, - -0.504384913277, -0.510813307110, -0.440694262582, - -0.300708292908, -0.200549034557}}, - B[3] = {0.864525353743, 1.243253422151, - -2.503097924792}; // fitted parameters - -const double offset[FISH_CLASS_NUM] = {0.25, 0.05, 0.25, 0, 0.15, - 0.2, 0.2, 0.1, 0.3, 0.15}; + {{0.031245754665, 0.408927414689, -0.236277908157, + 0.312233569326, -0.650706565353, 0.208001666710, + 0.134025076542, 0.022310548114, -0.528904220978, + 0.566728819567, 0.306536095251}, + {-0.452654476021, -0.591555546395, -0.286520879784, + -0.204632958100, 0.271553442603, -0.046010366297, + 0.538585714359, 0.338996586166, 1.200797439567, + 0.057895275191, 0.356526749625}, + {0.594389625935, 0.055345825155, 0.294034879793, + -0.265560742990, 0.093749871102, 0.143570197394, + -0.797929347925, -0.683466901431, -0.694927314353, + -0.548503360543, -0.782646406893}}, + B[3] = {0.789249430622, 1.812164387601, + -2.925873549802}; // fitted parameters + +const double offset[FISH_CLASS_NUM] = {0.3, 0.1, 0.25, 0, 0.2, + 0.2, 0.2, -0.1, 0.3, 0.25}; // dst = {a,b,v} void f(double* dst, double* x, double* y) {