@@ -14,19 +14,41 @@ To whole NSFW classification is based on [open_nsfw](https://github.com/yahoo/op
14
14
which uses [ caffe] ( https://github.com/BVLC/caffe ) . To install caffe follow the [ documentation] ( http://caffe.berkeleyvision.org/installation.html )
15
15
or these snippets below (they are basically the same).
16
16
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
17
25
``` sh
18
26
git clone https://github.com/yahoo/open_nsfw.git
19
27
git clone https://github.com/BVLC/caffe.git
28
+ ```
20
29
30
+ Install the required dependencies while in virtualenv already, tested on Ubuntu 16.04 and Manjaro
31
+
32
+ ``` sh
21
33
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
22
34
sudo apt-get install --no-install-recommends libboost-all-dev
23
35
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
24
43
cd caffe
25
44
pip install -r python/requirements.txt
26
45
cp Makefile.config.example Makefile.config # for the correct settings follow the previously mentioned documentation
27
46
make all -j2
28
47
make pycaffe
48
+ ```
29
49
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
30
52
export PYTHONPATH=/path/to/caffe/python:$PYTHONPATH
31
53
cd ../open_nsfw
32
54
python ./classify_nsfw.py \
@@ -38,13 +60,5 @@ INPUT_IMAGE_PATH
38
60
Now to install Velvet Check clone this repo, enter it and run the following commands.
39
61
``` sh
40
62
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
50
64
```
0 commit comments