Skip to content

Commit 472303f

Browse files
committed
update readme
1 parent 47fd239 commit 472303f

File tree

1 file changed

+23
-9
lines changed

1 file changed

+23
-9
lines changed

readme.md

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,41 @@ To whole NSFW classification is based on [open_nsfw](https://github.com/yahoo/op
1414
which uses [caffe](https://github.com/BVLC/caffe). To install caffe follow the [documentation](http://caffe.berkeleyvision.org/installation.html)
1515
or these snippets below (they are basically the same).
1616

17+
Create Python virtual env
18+
```sh
19+
pyenv install 3.8.2
20+
pyenv virtualenv 3.8.2 velvet-check
21+
pyenv local velvet-check
22+
```
23+
24+
Clone the caffe and yahoo's open\_nsfw
1725
```sh
1826
git clone https://github.com/yahoo/open_nsfw.git
1927
git clone https://github.com/BVLC/caffe.git
28+
```
2029

30+
Install the required dependencies while in virtualenv already, tested on Ubuntu 16.04 and Manjaro
31+
32+
```sh
2133
sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler libatlas-base-dev libgflags-dev libgoogle-glog-dev liblmdb-dev python-dev
2234
sudo apt-get install --no-install-recommends libboost-all-dev
2335

36+
# openblas doesn't work, see this comment
37+
# https://github.com/BVLC/caffe/issues/2353#issuecomment-612492470
38+
sudo pacman -Syu boost gflags google-glog cblas hdf5
39+
```
40+
41+
Build caffe and the python package, Makefile.config used at: https://gist.github.com/kviktor/6be1d8d569d293aa292c3badd65f8ab9
42+
```sh
2443
cd caffe
2544
pip install -r python/requirements.txt
2645
cp Makefile.config.example Makefile.config # for the correct settings follow the previously mentioned documentation
2746
make all -j2
2847
make pycaffe
48+
```
2949

50+
Test that it works (it probably won't as it doesn't support py3 out of the box, just modify tasks.py and check whats up)
51+
```sh
3052
export PYTHONPATH=/path/to/caffe/python:$PYTHONPATH
3153
cd ../open_nsfw
3254
python ./classify_nsfw.py \
@@ -38,13 +60,5 @@ INPUT_IMAGE_PATH
3860
Now to install Velvet Check clone this repo, enter it and run the following commands.
3961
```sh
4062
sudo apt-get install redis-server sqlite3
41-
pip install -r requirements.txt
42-
```
43-
44-
If you use virtualenv modify the postactivate file and add these settings (if not you can just paste them before starting the web server/celery ¯\\\_(ツ)\_
45-
```
46-
export MODEL_DEF_PATH='/path/to/open_nsfw/nsfw_model/deploy.prototxt'
47-
export PRETRAINED_MODEL_PATH='/path/to/open_nsfw/nsfw_model/resnet_50_1by2_nsfw.caffemodel'
48-
export PYTHONPATH=/path/to/caffe/python:
49-
export FLASK_APP="web.py"
63+
pip install -r server/requirements.txt
5064
```

0 commit comments

Comments
 (0)