SiamMask implementation with Tensorflow 2.
pip install tf-siammask
import numpy as np
import PIL.Image
import siammask
sm = siammask.SiamMask()
# Weight files are automatically retrieved from GitHub Releases
sm.load_weights()
# Adjust this parameter for the better mask prediction
sm.box_offset_ratio = 1.5
img_prev = np.array(PIL.Image.open('data/cat1.jpg'))[..., ::-1]
box_prev = np.array([[227, 184], [381, 274]])
img_next = np.array(PIL.Image.open('data/cat2.jpg'))[..., ::-1]
# Predicted box and mask images is created if `debug=True`
box, mask = sm.predict(img_prev, box_prev, img_next, debug=True)
Previous frame | Next frame | |
---|---|---|
File name | ./data/cat1_with_box.jpg |
./data/cat2.jpg |
Image |
- Bounding-box regression
- Mask refinement network
- Pre-trained model for Tensorflow 2.0
- Training code
- Object tracking code
@inproceedings{wang2019fast,
title={Fast online object tracking and segmentation: A unifying approach},
author={Wang, Qiang and Zhang, Li and Bertinetto, Luca and Hu, Weiming and Torr, Philip HS},
booktitle={Proceedings of the IEEE conference on computer vision and pattern recognition},
year={2019}
}