首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

神经网络图像处理服务neural-style的安装方法

neural-style 是一个利用显示卡GPU运算,通过卷积神经网络将两副甚至多幅图像合成一幅图像的运算处理软件,linux ubuntu16下实测没问题,windows估计不支持,显卡要求极高,GTX1070运算最高合成256*256px的图像,但是很好玩,贴出安装方法,给自己做个备份

以下配置都在Ubuntu linux环境中配置:

https://github.com/jcjohnson/neural-style/blob/master/INSTALL.md

进入安全模式

安装openssh-server

sudo service lightdm stop

N. 修改grub文件:sudo nano/etc/default/grub

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

1

改为

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nomodeset"

sudo update-grub

sudo service lightdm stop

CONTROL+ALT+F1

安装Nvdia驱动

安装显卡驱动

apt-get install linux-headers-`uname -r`

./Nvidia......驱动名

nvidia-smi

sudo apt-get install git

sudo apt-get install cmake

sudo apt-get install libreadline-dev

# in a terminal, run the commands

cd ~/

curl -s https://raw.githubusercontent.com/torch/ezinstall/master/install-deps | bash

git clone https://github.com/torch/distro.git ~/torch --recursive

cd ~/torch; ./install.sh

source ~/.bashrc

test torch

th

exit

Step 2: Install loadcaffe

loadcaffe depends on Google's Protocol Buffer library so we'll need to install that first:

sudo apt-get install libprotobuf-dev protobuf-compiler

Now we can instal loadcaffe:

luarocks install loadcaffe

Step 3: Install neural-style

First we clone neural-style from GitHub:

cd ~/

git clone https://github.com/jcjohnson/neural-style.git

cd neural-style

Next we need to download the pretrained neural network models:

sh models/download_models.sh

You should now be able to run neural-style in CPU mode like this:

th neural_style.lua -gpu -1 -print_iter 1

Step 4: Install CUDA

nvcc --version

`sudo dpkg -i cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64.deb`

sudo apt-key add /var/cuda-repo-9-0-local/7fa2af80.pub

sudo apt-get update

sudo apt-get install cuda

sudo nano /etc/environment

/usr/local/cuda/bin

source /etc/environment

Step 5: Install CUDA backend for torch

(Optional) Step 5: Install CUDA backend for torch

This is easy:

luarocks install cutorch

luarocks install cunn

th -e "require 'cutorch'; require 'cunn'; print(cutorch)"

最后运行合成图像:

th neural_style.lua -style_image style.png -content_image 1.jpg

  • 发表于:
  • 原文链接https://kuaibao.qq.com/s/20180526G0YLF500?refer=cp_1026
  • 腾讯「腾讯云开发者社区」是腾讯内容开放平台帐号(企鹅号)传播渠道之一,根据《腾讯内容开放平台服务协议》转载发布内容。
  • 如有侵权,请联系 cloudcommunity@tencent.com 删除。

扫码

添加站长 进交流群

领取专属 10元无门槛券

私享最新 技术干货

扫码加入开发者社群
领券