diff --git a/.gitignore b/.gitignore index b6e4761..4b9c67f 100644 --- a/.gitignore +++ b/.gitignore @@ -127,3 +127,7 @@ dmypy.json # Pyre type checker .pyre/ + +# DeepSentiBank-builder +source/extract_nfeatures +source/DeepSentiBank \ No newline at end of file diff --git a/README.md b/README.md index dd68f5e..e63160d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ -# DeepSentiBank-builder +# DeepSentiBank-Builder +[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) + Make the executable file (`extract_nfeatures`) for [DeepSentiBank](https://github.com/generalmilk/DeepSentiBank) in [Caffe](https://github.com/BVLC/caffe). ## Requirement @@ -8,18 +10,26 @@ Make the executable file (`extract_nfeatures`) for [DeepSentiBank](https://githu ## Usage - Run `docker-compose build`. - Run `docker-compose up -d`. -- Run `docker-compose exec builder bash`. -- Run `cp /opt/caffe/build/tools/extract_nfeatures .` in container. You can get the executable file (`extract_nfeatures`) in source folder. -## Run in DeepSentiBank +## Run DeepSentiBank +### Test in docker + +You can test creating json in this builder project. + +After running the following command, `test_image.json` file will be output to source/DeepSentibank folder. +- Run `docker-compose exec builder sh test.sh`. + +### Test in your project Download `caffe_sentibank_train_iter_250000` file from [HERE](https://www.dropbox.com/s/lv3p67m21kr3mrg/caffe_sentibank_train_iter_250000?dl=1). Then, add `extract_nfeatures` and `caffe_sentibank_train_iter_250000` file to your [DeepSentiBank](https://github.com/generalmilk/DeepSentiBank) folder, and run `python sentiBank.py test_image.jpg`. You can get output json file: `test_image.json`. + + ## Note #### (2020.01.24) Original `extract_nfeatures.cpp` in [DeepSentiBank](https://github.com/generalmilk/DeepSentiBank) contains a bug caused by [Caffe](https://github.com/BVLC/caffe) updates. (Look this [Issue](https://github.com/BVLC/caffe/issues/4107).) @@ -29,5 +39,11 @@ So we use a modified file (`source/extract_nfeatures.cpp`) instead of the origin #### (2021.07.15) The source of `caffe_sentibank_train_iter_250000` download link is [HERE](https://github.com/ColumbiaDVMM/ColumbiaImageSearch/blob/1326ee97ac1f032fdfbd5245c8356f59b254a9b5/cufacesearch/cufacesearch/featurizer/sbcmdline_img_featurizer.py#L18). +If the download link is broken, please contact me as I have a backup. + + +# License +This software is released under the MIT License, see LICENSE. +Copyright (c) 2020 Yuto Chikazawa. diff --git a/docker-compose.yml b/docker-compose.yml index dc2974c..8b6916a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,6 +10,9 @@ services: environment: - "TZ=Japan" working_dir: /usr/src/source + command: > + bash -c "cp /opt/caffe/build/tools/extract_nfeatures /usr/src/source && + /bin/bash" tty: true diff --git a/source/test.sh b/source/test.sh new file mode 100644 index 0000000..1ff6122 --- /dev/null +++ b/source/test.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +# test output file in DeepSentiBank + +if [ ! -e "DeepSentiBank" ]; then + echo "\n**************** Downloading DeepSentiBank ****************" + git clone --depth 1 https://github.com/generalmilk/DeepSentiBank +fi +rm DeepSentiBank/extract_nfeatures +cp extract_nfeatures DeepSentiBank/ +cd DeepSentiBank/ +if [ ! -e "caffe_sentibank_train_iter_250000" ]; then + echo "\n**************** Downloading sentibank trained model ****************" + wget https://www.dropbox.com/s/lv3p67m21kr3mrg/caffe_sentibank_train_iter_250000 +fi +echo "\n**************** Running sentiBank.py ****************" +python sentiBank.py test_image.jpg + +echo "\n** test_image.json created in source/DeepSentiBank!! **" \ No newline at end of file