Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make g++ compiled op library compatible with older abi. #100

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@
*.so
*.o
faster_rcnn_models
/data/VOCdevkit2007
data/cache/
data/pretrain_model/
output/
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This repository
The purpose of this repository is to make small improvements and bug fixes on smallcorgi's code https://github.com/smallcorgi/Faster-RCNN_TF. It's likely to be obsolete soon, as other object detection libraries become available in Tensorflow.

# Faster-RCNN_TF

This is an experimental Tensorflow implementation of Faster RCNN - a convnet for object detection with a region proposal network.
Expand Down
2 changes: 1 addition & 1 deletion experiments/scripts/faster_rcnn_end2end.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ exec &> >(tee -a "$LOG")
echo Logging output to "$LOG"

time python ./tools/train_net.py --device ${DEV} --device_id ${DEV_ID} \
--weights data/pretrain_model/VGG_imagenet.npy \
--weights ${NET} \
--imdb ${TRAIN_IMDB} \
--iters ${ITERS} \
--cfg experiments/cfgs/faster_rcnn_end2end.yml \
Expand Down
2 changes: 1 addition & 1 deletion lib/fast_rcnn/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

class SolverWrapper(object):
"""A simple wrapper around Caffe's solver.
This wrapper gives us control over he snapshotting process, which we
This wrapper gives us control over the snapshotting process, which we
use to unnormalize the learned bounding-box regression weights.
"""

Expand Down
4 changes: 2 additions & 2 deletions lib/make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ if [ -d "$CUDA_PATH" ]; then

g++ -std=c++11 -shared -o roi_pooling.so roi_pooling_op.cc \
roi_pooling_op.cu.o -I $TF_INC -D GOOGLE_CUDA=1 -fPIC $CXXFLAGS \
-lcudart -L $CUDA_PATH/lib64
-lcudart -L $CUDA_PATH/lib64 -D_GLIBCXX_USE_CXX11_ABI=0
else
g++ -std=c++11 -shared -o roi_pooling.so roi_pooling_op.cc \
-I $TF_INC -fPIC $CXXFLAGS
-I $TF_INC -fPIC $CXXFLAGS -D_GLIBCXX_USE_CXX11_ABI=0
fi

cd ..
Expand Down
19 changes: 13 additions & 6 deletions tools/test_net.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,22 @@ def parse_args():
print('Using config:')
pprint.pprint(cfg)

while not os.path.exists(args.model) and args.wait:
print('Waiting for {} to exist...'.format(args.model))
time.sleep(10)

weights_filename = os.path.splitext(os.path.basename(args.model))[0]

imdb = get_imdb(args.imdb_name)
imdb.competition_mode(args.comp_mode)

# Find the checkpoint directory, or wait until it exists.
checkpoint_dir = os.path.dirname(args.model)
while True:
ckpt = tf.train.get_checkpoint_state(checkpoint_dir)
if ckpt and ckpt.model_checkpoint_path:
break
else:
print('Waiting for checkpoint in directory {} to exist...'.format(checkpoint_dir))
time.sleep(10)


device_name = '/{}:{:d}'.format(args.device,args.device_id)
print device_name

Expand All @@ -91,7 +98,7 @@ def parse_args():
# start a session
saver = tf.train.Saver()
sess = tf.Session(config=tf.ConfigProto(allow_soft_placement=True))
saver.restore(sess, args.model)
print ('Loading model weights from {:s}').format(args.model)
saver.restore(sess, ckpt.model_checkpoint_path)
print ('Loading model weights from {:s}').format(ckpt.model_checkpoint_path)

test_net(sess, network, imdb, weights_filename)