macos上的硬盘检测工具_如何在MacOS上使用双镜头面部检测器(DSFD)实现90%以上的精度
macos上的硬盤檢測工具
新程序員指南: (New Programmer’s Guide:)
介紹: (Introduction:)
This article is for those of us still early in our programming path — keep going
本文適用于尚處于編程道路初期的我們這些人-繼續前進
If you’re still new to programming, I encourage you to complete this tutorial because DSFD is worth it and going through this process will stretch you.
如果您還不熟悉編程,建議您完成本教程,因為DSFD是值得的,并且逐步完成此過程將使您受益匪淺。
It’s intentionally thorough, so you should have everything you need.
這是有意為之的,因此您應該擁有所需的一切。
But if something isn’t covered, leave a comment and we’ll figure it out.
但是,如果未涵蓋某些內容,請發表評論,我們會解決。
This article is written for MacOS, but it’s also available for Windows.
本文是針對MacOS編寫的,但也適用于Windows 。
背景: (Background:)
In this paper, Tencent introduces its open-sourced Dual Shot Face Detector (DSFD) algorithm. DSFD is a new face detection network that addresses three key areas of facial detection. This includes better feature learning, progressive loss design, and anchor assign based data augmentation.
在本文中 ,騰訊介紹了其開源的雙鏡頭面部檢測器 (DSFD)算法。 DSFD是一個新的面部檢測網絡 ,解決了面部檢測的三個關鍵領域。 這包括更好的功能學習,漸進式損失設計以及基于錨分配的數據擴充。
In 2018, the DSFD algorithm ranked first across the board in the WIDER FACE Face Detection Benchmark.
在2018年,DSFD算法在WIDER FACE人臉檢測基準測試中全面排名第一。
DSFDDSFD提供The benchmark evaluation tested the detection systems for mean average precision (mAP) on set portions of the dataset split into three difficulty levels.
基準評估測試了檢測系統在分為三個難度級別的數據集的設置部分的平均平均精度 (mAP)。
Validation set scores:
驗證集分數:
- 96.6% (mAP) in the easy difficulty level 輕松難度水平為96.6%(mAP)
- 95.7% (mAP) in the medium difficulty level 中難度水平為95.7%(mAP)
- 90.4% (mAP) in the hard difficulty level 困難難度等級為90.4%(mAP)
Test set scores:
測試集分數:
- 96.0% (mAP) in the easy difficulty level 輕松難度水平為96.0%(mAP)
- 95.3% (mAP) in the medium difficulty level 中難度水平為95.3%(mAP)
- 90.0% (mAP) in the hard difficulty level 困難難度等級為90.0%(mAP)
In this paper, the Multitask Cascade CNN (MTCNN) was evaluated using the same WIDER FACE Face Detection Benchmark.
本文使用相同的WIDER FACE人臉檢測基準對多任務級聯CNN(MTCNN)進行了評估。
Validation set scores:
驗證集分數:
- 84.8% (mAP) in the easy difficulty level 輕松難度水平為84.8%(mAP)
- 82.5% (mAP) in the medium difficulty level 中難度水平為82.5%(mAP)
- 60.7% (mAP) in the hard difficulty level 困難難度水平為60.7%(mAP)
Test set scores:
測試集分數:
- 85.1% (mAP) in the easy difficulty level 輕松難度水平為85.1%(mAP)
- 82.0% (mAP) in the medium difficulty level 中難度水平為82.0%(mAP)
- 60.7% (mAP) in the hard difficulty level 困難難度水平為60.7%(mAP)
克隆存儲庫: (Clone the Repository:)
First, we’ll open Terminal:
首先,我們打開終端:
Next, we’ll use the mkdir command to create the project directory:
接下來,我們將使用mkdir命令創建項目目錄:
Next, we’ll use the cd command to navigate to the project directory:
接下來,我們將使用cd命令導航到項目目錄:
Next, we’ll use the git clone command to download the repository:
接下來,我們將使用git clone命令下載存儲庫:
Next, we’ll use the cd command to navigate to the repository directory:
接下來,我們將使用cd命令導航到存儲庫目錄:
設置Python要求: (Set Up the Python Requirement:)
First, we’ll download Python 3.6:
首先,我們將下載Python 3.6:
Visit the download page on the official website
訪問官方網站上的下載頁面
Next, we’ll install the required Python version:
接下來,我們將安裝所需的Python版本:
創建虛擬環境: (Create the Virtual Environment:)
The virtualenv command creates a virtual environment with the specified Python version. The command format is command name, Python parameter, Python executable file, virtual environment name.
virtualenv命令使用指定的Python版本創建虛擬環境。 命令格式為命令名稱,Python參數,Python可執行文件,虛擬環境名稱。
First, we’ll install virtualenv:
首先,我們將安裝virtualenv:
Next, we’ll create the virtual environment with Python 3.6:
接下來,我們將使用Python 3.6創建虛擬環境:
Next, we’re going to activate the virtual environment:
接下來,我們將激活虛擬環境:
The virtual environment name will appear on the command-line while active.
虛擬環境名稱在活動時將顯示在命令行上。
All pip installations will now be saved in the local virtual environment.
現在,所有pip安裝都將保存在本地虛擬環境中。
source venv36/bin/activate設置火炬要求: (Set Up the Torch Requirement:)
First, we’ll download Torch 0.3.1:
首先,我們將下載Torch 0.3.1:
Visit the download page for your Cuda version: [Cpu Only]
訪問您的Cuda版本的下載頁面:[ 僅Cpu ]
The Torch version required isn’t available in pip or anaconda.
所需的Torch版本在pip或anaconda中不可用。
torch-0.3.1-cp36-cp36m-macosx_10_7_x86_64.whlNext, we’ll use the mouse to move the wheel file:
接下來,我們將使用鼠標移動wheel文件:
Lastly, we’ll install Torch:
最后,我們將安裝Torch:
設置TorchVision要求: (Set Up the TorchVision Requirement:)
First, we’ll download Torchvision 0.2.1:
首先,我們將下載Torchvision 0.2.1:
Visit the archive page for your system type: [All]
訪問存檔頁面以查找您的系統類型:[ 全部 ]
The TorchVision version required isn’t available in pip or anaconda.
所需的TorchVision版本在pip或anaconda中不可用。
torchvision-0.2.1-py2.py3-none-any.whlNext, we’ll use the mouse to move the wheel file:
接下來,我們將使用鼠標移動wheel文件:
Lastly, we’ll install Torchvision:
最后,我們將安裝Torchvision:
設置其他要求: (Set Up the Other Requirements:)
First, we’ll install the other requirements:
首先,我們將安裝其他要求:
Next, we’ll use the mkdir command to create a subdirectory:
接下來,我們將使用mkdir命令創建一個子目錄:
This subdirectory is used to store the output images.
該子目錄用于存儲輸出圖像。
mkdir eval_tools設置模型: (Set Up the Model:)
First, we’ll download the model file:
首先,我們將下載模型文件:
Visit the DSFD Google Drive
訪問DSFD Google云端硬盤
Next, we’ll use the mkdir command to create a subdirectory:
接下來,我們將使用mkdir命令創建一個子目錄:
Next, we’ll use the mouse to move the model file:
接下來,我們將使用鼠標移動模型文件:
設置注釋: (Set Up the Annotations:)
First, we’ll download the annotations file:
首先,我們將下載注釋文件:
Visit the WIDER FACE official site
訪問WIDER FACE 官方網站
Next, we’ll use the mouse to move the annotations file:
接下來,我們將使用鼠標移動注釋文件:
Lastly, we’ll unzip the annotations file:
最后,我們將解壓注釋文件:
修正錯誤: (Fix the Errors:)
The following solutions were pieced together by:
以下解決方案組合在一起:
Reading through the “open” and “closed” issues section of the repository
通讀存儲庫的“ 打開 ”和“ 關閉 ”問題部分
Translating different languages with Google Translate extension
使用Google翻譯擴展程序翻譯不同的語言
Googling the error message and reading through the first five results
搜尋錯誤訊息并讀取前五個結果
The line numbers are not exact and meant to be used as approximations.
行號不精確,只能用作近似值。
錯誤1: (Error #1:)
UserWarning: volatile was removed and now has no effect. Use `with torch.no_grad():` instead
UserWarning:volatile已刪除,現在無效。 使用`with torch.no_grad():`代替
In this section, we’ll add edit to the following files:
在本節中,我們將對以下文件添加編輯:
- demo.py 演示
- face_ssd.py face_ssd.py
- widerface_val.py wideface_val.py
錯誤2: (Error #2:)
RuntimeError: CUDA out of memory. Tried to allocate 44.25 MiB (GPU 0; 11.00 GiB total capacity; 9.56 GiB already allocated; 10.25 MiB free; 49.26 MiB cached)
RuntimeError:CUDA內存不足。 嘗試分配44.25 MiB(GPU 0; 11.00 GiB總容量;已分配9.56 GiB; 10.25 MiB空閑; 49.26 MiB已緩存)
In this section, we’ll add edit to the following file:
在本節中,我們將編輯添加到以下文件:
- demo.py 演示
錯誤3: (Error #3:)
FileNotFoundError: [Errno 2] No such file or directory: ‘/data2/lijian/widerface/data/wider_face_split\\wider_face_val.mat’
FileNotFoundError:[錯誤2]沒有這樣的文件或目錄:'/data2/lijian/widerface/data/wider_face_split\\wider_face_val.mat'
In this section, we’ll edit the following file :
在本節中,我們將編輯以下文件:
- data\widerface.py 數據\ widerface.py
錯誤4: (Error #4:)
ImportError: cannot import name ‘pa_sfd_match’
ImportError:無法導入名稱“ pa_sfd_match”
In this section, we’ll edit the following file:
在本節中,我們將編輯以下文件:
- layers\modules\multibox_loss.py 圖層\模塊\ multibox_loss.py
錯誤5: (Error #5:)
TypeError: mul(): argument ‘other’ (position 1) must be Tensor, not numpy.ndarray
TypeError:mul():參數'other'(位置1)必須為Tensor,而不是numpy.ndarray
In this section, we’ll edit to the following file:
在本節中,我們將編輯以下文件:
- demo.py 演示
錯誤#6: (Error #6:)
RuntimeError: Attempting to deserialize object on a CUDA device but torch.cuda.is_available() is False. If you are running on a CPU-only machine, please use torch.load with map_location=’cpu’ to map your storages to the CPU.
RuntimeError:嘗試在CUDA設備上反序列化對象,但是torch.cuda.is_available()為False。 如果您在僅CPU的計算機上運行,??請使用帶有map_location ='cpu'的torch.load將存儲映射到CPU。
This step only applies to computers that don’t have a GPU — CPU only.
此步驟僅適用于沒有GPU的計算機-僅適用于CPU。
In this section, we’ll change edit the following file:
在本節中,我們將更改編輯以下文件:
- venv36/lib/python3.6/site-packages/torch/serialization.py venv36 / lib / python3.6 / site-packages / torch / serialization.py
錯誤7: (Error #7:)
AssertionError: Torch not compiled with CUDA enabled.
AssertionError:火炬未在啟用CUDA的情況下編譯。
This step only applies to computers that don’t have a GPU — CPU only.
此步驟僅適用于沒有GPU的計算機-僅適用于CPU。
In this section, we’ll edit in the following files:
在本節中,我們將編輯以下文件:
- demo.py 演示
- widerface_val.py wideface_val.py
錯誤#8: (Error #8:)
UserWarning: Default upsampling behavior when mode=bilinear is changed to align_corners=False since 0.4.0. Please specify align_corners=True if the old behavior is desired. See the documentation of nn.Upsample for details. “See the documentation of nn.Upsample for details.”.format(mode))
UserWarning:自0.4.0開始,當mode = bilinear更改為align_corners = False時,默認的上采樣行為。 如果需要舊的行為,請指定align_corners = True。 有關詳細信息,請參見nn.Upsample的文檔。 “有關詳細信息,請參見nn.Upsample的文檔。”。format(mode))
Lastly, we’ll edit the following file:
最后,我們將編輯以下文件:
- demo.py 演示
獲取命令行參數: (Get the Command-Line Parameters:)
Sometimes, the command-line parameters are not included in a repository’s description. In that case, the parameters can usually be found underneath the import section in the code file.
有時,命令行參數未包含在存儲庫的描述中。 在這種情況下,通常可以在代碼文件的import部分下面找到參數。
Check the Add Argument method:
檢查添加參數方法:
- The first argument is the parameter. 第一個參數是參數。
- The last argument describes what it does 最后一個參數描述了它的作用
For example:
例如:
- “ — image_root” refers to the “location of test image directory” “ — image_root”是指“測試圖像目錄的位置”
- “ — visual_threshold” refers to the “final confidence threshold” “ — visual_threshold”是指“最終置信度閾值”
parser = argparse.ArgumentParser(description='DSFD:Dual Shot Face Detector')
parser.add_argument('--trained_model', default='weights/WIDERFace_DSFD_RES152.pth',
type=str, help='Trained state_dict file path to open')
parser.add_argument('--save_folder', default='eval_tools/', type=str,
help='Dir to save results')
parser.add_argument('--visual_threshold', default=0.1, type=float,
help='Final confidence threshold')
parser.add_argument('--cuda', default=False, type=bool,
help='Use cuda to train model')
parser.add_argument('--img_root', default='./data/worlds-largest-selfie.jpg', help='Location of test images directory')
parser.add_argument('--widerface_root', default=WIDERFace_ROOT, help='Location of WIDERFACE root directory')
args = parser.parse_args()
測試演示 (Test the Demo)
In this section, we’ll test the demo.py file:
在本節中,我們將測試demo.py文件:
停用虛擬環境: (Deactivate the Virtual Environment:)
In this section, we’ll deactivate the virtual environment:
在本節中,我們將停用虛擬環境:
The virtual environment name will then disappear from the command-line.
然后,虛擬環境名稱將從命令行中消失。
All pip installations will now be saved in the regular Python environment.
現在,所有pip安裝都將保存在常規Python環境中。
deactivate致謝: (Acknowledgments:)
@oyerst solved this issue
@ oyerst解決了這個問題
@hypadr1v3 solved this issue
@ hypadr1v3解決了這個問題
@lijiannuist solved this issue and that issue
@ lijiannuist解決了這個問題和那個問題
@vlad3996 solved this issue
@ vlad3996解決了這個問題
@yihongXU solved this issue
@yihongXU解決了這個問題
翻譯自: https://medium.com/macoclock/how-to-implement-the-dual-shot-face-detector-dsfd-demo-on-macos-706dde217ead
macos上的硬盤檢測工具
總結
以上是生活随笔為你收集整理的macos上的硬盘检测工具_如何在MacOS上使用双镜头面部检测器(DSFD)实现90%以上的精度的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 机器学习中激活函数和模型_探索机器学习中
- 下一篇: 2022 生成模型进展有多快,新论文盘点