Skip to content

Commit

Permalink
Merge pull request #6 from Haru0517/test-deepsentibank
Browse files Browse the repository at this point in the history
Test deepsentibank
  • Loading branch information
ychikazawa authored Jul 16, 2021
2 parents 7e9c346 + 29c6dd2 commit 97475b1
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 4 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,7 @@ dmypy.json

# Pyre type checker
.pyre/

# DeepSentiBank-builder
source/extract_nfeatures
source/DeepSentiBank
24 changes: 20 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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).)
Expand All @@ -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.
3 changes: 3 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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


19 changes: 19 additions & 0 deletions source/test.sh
Original file line number Diff line number Diff line change
@@ -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!! **"

0 comments on commit 97475b1

Please sign in to comment.