|
| 1 | +# Velvet Check  |
| 2 | + |
| 3 | +A simple utility to check the NSFW level of articles at the Velvet section of [index.hu](http://index.hu). |
| 4 | + |
| 5 | +### Before |
| 6 | + |
| 7 | + |
| 8 | +### After |
| 9 | + |
| 10 | + |
| 11 | +## Installation |
| 12 | + |
| 13 | +To whole NSFW classification is based on [open_nsfw](https://github.com/yahoo/open_nsfw) |
| 14 | +which uses [caffe](https://github.com/BVLC/caffe). To install caffe follow the [documentation](http://caffe.berkeleyvision.org/installation.html) |
| 15 | +or these snippets below (they are basically the same). |
| 16 | + |
| 17 | +```sh |
| 18 | +git clone https://github.com/yahoo/open_nsfw.git |
| 19 | +git clone https://github.com/BVLC/caffe.git |
| 20 | + |
| 21 | +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 | +sudo apt-get install --no-install-recommends libboost-all-dev |
| 23 | + |
| 24 | +cd caffe |
| 25 | +pip install -r python/requirements.txt |
| 26 | +cp Makefile.config.example Makefile.config # for the correct settings follow the previously mentioned documentation |
| 27 | +make all -j2 |
| 28 | +make pycaffe |
| 29 | + |
| 30 | +export PYTHONPATH=/path/to/caffe/python:$PYTHONPATH |
| 31 | +cd ../open_nsfw |
| 32 | +python ./classify_nsfw.py \ |
| 33 | +--model_def nsfw_model/deploy.prototxt \ |
| 34 | +--pretrained_model nsfw_model/resnet_50_1by2_nsfw.caffemodel \ |
| 35 | +INPUT_IMAGE_PATH |
| 36 | +``` |
| 37 | + |
| 38 | +Now to install Velvet Check clone this repo, enter it and run the following commands. |
| 39 | +```sh |
| 40 | +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" |
| 50 | +``` |
0 commit comments