API Reference: Detection Models
TensorNets offers generic object detection models that can be paired with various convolutional backbones for feature extraction.
Common Signature
The generic detection models in tensornets.detections
follow this signature:
def ModelName(x, stem_fn, stem_out=None, is_training=False, classes=20, scope=None, reuse=None):
x
: Atf.Tensor
for the input images.stem_fn
: A function representing the backbone network (e.g.,nets.Darknet19
,nets.ResNet50
). This function will be called withstem=True
to get the feature map.stem_out
: An optional string specifying the name of the layer from thestem_fn
to use as the feature map. IfNone
, the final feature map of the backbone is used.is_training
: A boolean controlling training-specific behavior.classes
: The number of object classes to detect (e.g., 20 for PASCAL VOC).
Available Models
YOLOv2
Implements the YOLOv2 object detection model.
import tensornets as nets
inputs = tf.placeholder(tf.float32, [None, 416, 416, 3])
model = nets.YOLOv2(inputs, stem_fn=nets.Darknet19, classes=20)
TinyYOLOv2
A smaller, faster version of YOLOv2.
import tensornets as nets
inputs = tf.placeholder(tf.float32, [None, 416, 416, 3])
model = nets.TinyYOLOv2(inputs, stem_fn=nets.TinyDarknet19, classes=20)
FasterRCNN
Implements the Faster R-CNN object detection model.
import tensornets as nets
inputs = tf.placeholder(tf.float32, [None, 600, 1000, 3])
# Using VGG16 as a backbone, extracting features from 'conv5/3'
model = nets.FasterRCNN(inputs, stem_fn=nets.VGG16, stem_out='conv5/3', classes=21)
Pre-configured Reference Models
For convenience, TensorNets also provides pre-configured detection models with specific backbones and pre-trained weights for common datasets.
nets.YOLOv3COCO
,nets.YOLOv3VOC
nets.YOLOv2COCO
,nets.YOLOv2VOC
nets.TinyYOLOv2VOC
nets.FasterRCNN_ZF_VOC
nets.FasterRCNN_VGG16_VOC