https:///darknet/install/
Installing Darknet
Darknet is easy to install with only two optional dependancies:
- OpenCV if you want a wider variety of supported image types.
- CUDA if you want GPU computation.
- Darknet易于安裝,只有兩個可選依賴項:
- OpenCV如果你想要更多種類的支持圖像類型。
- CUDA如果你想GPU計算。
Both are optional so lets start by just installing the base system. I've only tested this on Linux and Mac computers. If it doesn't work for you, email me or something?
兩者都是可選的,所以我們從安裝基礎(chǔ)系統(tǒng)開始。 我只在Linux和Mac電腦上測試過。 如果它不適合你,給我發(fā)電子郵件或其他東西?
Installing The Base System
First clone the Darknet git repository here. This can be accomplished by:
首先在這里克隆Darknet git倉庫。 這可以通過以下方式完成:
git clone https://github.com/pjreddie/darknet.git
cd darknet
make
If this works you should see a whole bunch of compiling information fly by:
如果這項工作你應(yīng)該看到一大堆編譯信息飛過:
mkdir -p obj
gcc -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Ofast....
gcc -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Ofast....
gcc -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Ofast....
.....
gcc -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Ofast -lm....
If you have any errors, try to fix them? If everything seems to have compiled correctly, try running it!
如果您有任何錯誤,請嘗試修復它們? 如果一切似乎編譯正確,請嘗試運行它!
./darknet
You should get the output:
你應(yīng)該得到輸出:
usage: ./darknet <function>
Great! Now check out the cool things you can do with darknet here.
大! 現(xiàn)在查看你可以用darknet在這里做的很酷的事情。
Compiling With CUDA 使用CUDA進行編譯
Darknet on the CPU is fast but it's like 500 times faster on GPU! You'll have to have an Nvidia GPU and you'll have to install CUDA. I won't go into CUDA installation in detail because it is terrifying.
CPU上的Darknet速度很快,但它在GPU上快500倍! 你必須有一個Nvidia GPU,你必須安裝CUDA。 我不會詳細介紹CUDA安裝,因為它很可怕。
Once you have CUDA installed, change the first line of the Makefile
in the base directory to read:
一旦安裝了CUDA,將基本目錄中的Makefile的第一行改為:
GPU=1
Now you can make
the project and CUDA will be enabled. By default it will run the network on the 0th graphics card in your system (if you installed CUDA correctly you can list your graphics cards using nvidia-smi
). If you want to change what card Darknet uses you can give it the optional command line flag -i <index>
, like:
現(xiàn)在您可以使項目和CUDA啟用。 默認情況下,它將在系統(tǒng)中的第0個圖形卡上運行網(wǎng)絡(luò)(如果您正確安裝了CUDA,則可以使用nvidia-smi列出您的圖形卡)。 如果你想改變Darknet使用什么卡,你可以給它一個可選的命令行標志-i <index>,例如:
./darknet -i 1 imagenet test cfg/alexnet.cfg alexnet.weights
If you compiled using CUDA but want to do CPU computation for whatever reason you can use -nogpu
to use the CPU instead:
如果您使用CUDA進行編譯,但是無論出于何種原因都想要執(zhí)行CPU計算,則可以使用-nogpu來使用CPU:
./darknet -nogpu imagenet test cfg/alexnet.cfg alexnet.weights
Enjoy your new, super fast neural networks!
享受你的新的,超快的神經(jīng)網(wǎng)絡(luò)!
Compiling With OpenCV 編譯與OpenCV
By default, Darknet uses stb_image.h
for image loading. If you want more support for weird formats (like CMYK jpegs, thanks Obama) you can use OpenCV instead! OpenCV also allows you to view images and detections without having to save them to disk.
默認情況下,Darknet使用stb_image.h進行圖像加載。 如果你想要更多奇怪格式的支持(比如CMYK jpegs,感謝奧巴馬),你可以改用OpenCV! OpenCV還允許您查看圖像和檢測,而無需將它們保存到磁盤。
First install OpenCV. If you do this from source it will be long and complex so try to get a package manager to do it for you.
首先安裝OpenCV。 如果你是從源代碼做到這一點,它會很長,很復雜,所以試著讓包管理器為你做。
Next, change the 2nd line of the Makefile
to read:
接下來,將Makefile的第二行更改為:
OPENCV=1
You're done! To try it out, first re-make
the project. Then use the imtest
routine to test image loading and displaying:
你完成了! 要嘗試一下,首先重新制作該項目。 然后使用imtest例程來測試圖像加載和顯示:
./darknet imtest data/eagle.jpg
If you get a bunch of windows with eagles in them you've succeeded! They may look like:
如果你在他們身上得到一堆帶鷹的窗戶,你就成功了! 他們可能看起來像: