月度归档:2022年10月

OpenCV的人脸检测+ncnn::Extractor特征提取

第一步:通过opencv或yolo进行人脸检测,获取人脸头像信息。

第二步:通过nccn::Extractor获取特征

https://github.com/Tencent/ncnn/

  • https://github.com/Tencent/ncnn
  • https://github.com/MegEngine/MegEngine
  • https://github.com/alibaba/tengine
  • https://github.com/OAID/Tengine
  • https://github.com/alibaba/MNN
  • https://github.com/Ewenwan/MVision

Dlib Resnet 

anaconda和pip更换为国内源

查看当前源

conda config --show channels

优先使用中科大源

conda config --remove-key channels
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.bfsu.edu.cn/anaconda/cloud/pytorch/
conda config --set show_channel_urls yes
pip config set global.index-url https://mirrors.ustc.edu.cn/pypi/web/simple

清华大学conda镜像

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --append channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/fastai/
conda config --append channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
conda config --append channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/
conda config --set show_channel_urls yes

Qt For Android在Window中用脚本批量编译参考

想得太天真了,以为在Windows解决个别仓库的脚本编译问题,就可以一劳永逸地在Window中自由开发安卓了,当连接的第三方库越多,越会发现选择在Windows中开发安卓是多么悲壮的事情,有些库是无法在windows中编译的如openssl。

如果非要在Windows中开发呢?有一个方案就是在Linux编译,生成库文件,在Windows中使用,但那又苦呢?

——————————————————————

几经波折及艰难的研究Android编译过程,最后总算编写出完整的、能在Windows运行的与Qt默认方式编译一致的脚本【网上也有Nijia的编译方式】,具体如下,

@echo off
set path_script=%~dp0

cd /D %path_script%
rd /s/q "%path_script%\build"
rd /s/q "%path_script%\android"

md "%path_script%\build"
cd /D "%path_script%\build"




set ANDROID_NDK_HOST=windows-x86_64
set ANDROID_SDK_ROOT=E:/android/AndroidSdk
set ANDROID_NDK_ROOT=%ANDROID_SDK_ROOT%/ndk/21.3.6528147
set QT_ROOT=C:\Qt\Qt5.12.12
set PATH=%PATH%;%QT_ROOT%\Tools\QtCreator\bin\jom\;%QT_ROOT%\Tools\QtCreator\bin

if not exist "%ANDROID_SDK_ROOT%" (
    echo "not exist path:%ANDROID_SDK_ROOT%"
    pause
)

if not exist "%ANDROID_NDK_ROOT%" (
    echo "not exist path:%ANDROID_NDK_ROOT%"
    pause
)

setlocal enabledelayedexpansion
for %%i in ("x86","armeabi-v7a","arm64-v8a") do (     
    cd %path_script%
    rd /s/q "%path_script%\build"   
    md "%path_script%\build"
    if %%i=="x86" (
        echo "abi type:x86"
        set arch=x86
        set abi=x86
    )
    if %%i=="armeabi-v7a" (
        echo "abi type: armeabi-v7a"
        set arch=armv7
        set abi=armeabi-v7a
    )
    if %%i=="arm64-v8a" (
        echo "abi type: arm64-v8a"
        set arch=arm64_v8a
        set abi=arm64-v8a
    )
    set QTDIR=%QT_ROOT%\5.12.12\android_!arch!
    if not exist "!QTDIR!" (
        echo "not exist path:!QTDIR!"
        pause
    )
    set ANDROID_DEFINITION="-GNMake Makefiles JOM"
    set ANDROID_DEFINITION=!ANDROID_DEFINITION! "-DCMAKE_PROJECT_INCLUDE_BEFORE:PATH=!QT_ROOT!/Tools/QtCreator/share/qtcreator/package-manager/auto-setup.cmake"
    set ANDROID_DEFINITION=!ANDROID_DEFINITION! "-DQT_QMAKE_EXECUTABLE:STRING=!QTDIR!/bin/qmake.exe"
    set ANDROID_DEFINITION=!ANDROID_DEFINITION! "-DCMAKE_PREFIX_PATH:STRING=!QTDIR!"
    set ANDROID_DEFINITION=!ANDROID_DEFINITION! "-DCMAKE_C_COMPILER:STRING=!ANDROID_NDK_ROOT!/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe"
    set ANDROID_DEFINITION=!ANDROID_DEFINITION! "-DCMAKE_CXX_COMPILER:STRING=!ANDROID_NDK_ROOT!/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe"
    set ANDROID_DEFINITION=!ANDROID_DEFINITION! "-DANDROID_NDK:PATH=!ANDROID_NDK_ROOT!"
    set ANDROID_DEFINITION=!ANDROID_DEFINITION! "-DCMAKE_TOOLCHAIN_FILE:PATH=!ANDROID_NDK_ROOT!/build/cmake/android.toolchain.cmake"
    set ANDROID_DEFINITION=!ANDROID_DEFINITION! "-DANDROID_STL:STRING=c++_shared"
    set ANDROID_DEFINITION=!ANDROID_DEFINITION! "-DCMAKE_FIND_ROOT_PATH:PATH=!QTDIR!"
    set ANDROID_DEFINITION=!ANDROID_DEFINITION! "-DANDROID_SDK:PATH=!ANDROID_SDK_ROOT!"
    set ANDROID_DEFINITION=!ANDROID_DEFINITION! "-DANDROID_NATIVE_API_LEVEL:STRING=16"
    set ANDROID_DEFINITION=!ANDROID_DEFINITION! "-DANDROID_ABI:STRING=!abi!"
    set ANDROID_DEFINITION=!ANDROID_DEFINITION! "-DBUILD_SHARED_LIBS:STRING=OFF"

    cd %path_script%/build && cmake.exe  ../zlib-1.2.11 !ANDROID_DEFINITION! -DCMAKE_INSTALL_PREFIX="%path_script%/android/!abi!" 
    cmake --build . --config Release && cmake --build ./ --config Release --target install
)
endlocal
cd %path_script%

安装build-essential报错的解决方案

安装build-essential报以下错误。

The following packages have unmet dependencies:
 build-essential : Depends: libc6-dev but it is not going to be installed or
                            libc-dev
                   Depends: gcc (>= 4:7.2) but it is not going to be installed
                   Depends: g++ (>= 4:7.2) but it is not going to be installed
                   Depends: dpkg-dev (>= 1.17.11) but it is not going to be inst

解决方案

断网重装可以解决,因为不断网时,系统获取升级文件,升级了内核很多新问题,产生冲突了。

从零开始构建:Qt与AndroidStudio混合调试

1.报Failed to find Build Tools revision 28.0.3的错误,如下所示:

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android-build'.
> Failed to find Build Tools revision 28.0.3
关注红色提示,“Failed to find Build Tools revision 28.0.3”

AndroidStudio的代理配置,

Android Studio的代理设置,一定要填写代理的域名,否则就等于没有变化或无效了。

在执行gladle构建时,总提示dl.google.com的443没有连接上,但奇怪的是使用AndroidSDK也是使用dl.google.com进行版本更新的,一直也很流畅。所以一直没有怀疑是防火墙问题,后来也把代理填上了,但没有填写No proxy for:的相关字段,也是无法连接上。

最后实在没有办法了,在no proxy for 都填上了,却发现可以下载了,神奇吧。

现在想想,应该是Android SDK的更新,应该是设置了内部翻墙的能力了。