Skip to content

Commit

Permalink
0.13.2 (#1102)
Browse files Browse the repository at this point in the history
* Increment version to 0.13.2 (#1095)

* Bump version

* Update configs

* dapricot test set (#1096)

* cherry-picked dapricot test commits from 1088

* correct checksum filename

* Coco (#1097)

* cherry-picking commits from 1085, excluding the commit merging in dev branch

* adding coco tests, skipping if not available locally

* adding note to docs about apricot class indexing

* updated checksum after new upload to s3

Co-authored-by: ng390 <neal.gupta@twosixlabs.com>
  • Loading branch information
lcadalzo and ng390 authored Jun 10, 2021
1 parent deb7a46 commit b013f6c
Show file tree
Hide file tree
Showing 59 changed files with 756 additions and 172 deletions.
2 changes: 1 addition & 1 deletion armory/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


# Semantic Version
__version__ = "0.13.1"
__version__ = "0.13.2"


# Submodule imports
Expand Down
72 changes: 19 additions & 53 deletions armory/baseline_models/tf_graph/mscoco_frcnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,63 +9,29 @@
import tensorflow as tf


class TensorFlowFasterRCNNOneIndexed(TensorFlowFasterRCNN):
"""
This is an MSCOCO pre-trained model. Note that the inherited TensorFlowFasterRCMM class
outputs 0-indexed classes, while this wrapper class outputs 1-indexed classes. A label map can be found at
https://github.com/tensorflow/models/blob/master/research/object_detection/data/mscoco_label_map.pbtxt
This model only performs inference and is not trainable. To train
or fine-tune this model, please follow instructions at
https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/tf1.md
"""

def __init__(self, images):
super().__init__(
images,
model=None,
filename="faster_rcnn_resnet50_coco_2018_01_28",
url="http://download.tensorflow.org/models/object_detection/faster_rcnn_resnet50_coco_2018_01_28.tar.gz",
sess=None,
is_training=False,
clip_values=(0, 1),
channels_first=False,
preprocessing_defences=None,
postprocessing_defences=None,
attack_losses=(
"Loss/RPNLoss/localization_loss",
"Loss/RPNLoss/objectness_loss",
"Loss/BoxClassifierLoss/localization_loss",
"Loss/BoxClassifierLoss/classification_loss",
),
)

def compute_loss(self, x, y):
raise NotImplementedError

def loss_gradient(self, x, y, **kwargs):
y_zero_indexed = []
for y_dict in y:
y_dict_zero_indexed = y_dict.copy()
y_dict_zero_indexed["labels"] = y_dict_zero_indexed["labels"] - 1
y_zero_indexed.append(y_dict_zero_indexed)
return super().loss_gradient(x, y_zero_indexed, **kwargs)

def predict(self, x, **kwargs):
list_of_zero_indexed_pred_dicts = super().predict(x, **kwargs)
list_of_one_indexed_pred_dicts = []
for img_pred_dict in list_of_zero_indexed_pred_dicts:
zero_indexed_pred_labels = img_pred_dict["labels"]
img_pred_dict["labels"] = zero_indexed_pred_labels + 1
list_of_one_indexed_pred_dicts.append(img_pred_dict)
return list_of_one_indexed_pred_dicts


def get_art_model(model_kwargs, wrapper_kwargs, weights_file=None):
# APRICOT inputs should have shape (1, None, None, 3) while DAPRICOT inputs have shape
# (3, None, None, 3)
images = tf.placeholder(
tf.float32, shape=(model_kwargs.get("batch_size", 1), None, None, 3)
)
model = TensorFlowFasterRCNNOneIndexed(images)
model = TensorFlowFasterRCNN(
images,
model=None,
filename="faster_rcnn_resnet50_coco_2018_01_28",
url="http://download.tensorflow.org/models/object_detection/faster_rcnn_resnet50_coco_2018_01_28.tar.gz",
sess=None,
is_training=False,
clip_values=(0, 1),
channels_first=False,
preprocessing_defences=None,
postprocessing_defences=None,
attack_losses=(
"Loss/RPNLoss/localization_loss",
"Loss/RPNLoss/objectness_loss",
"Loss/BoxClassifierLoss/localization_loss",
"Loss/BoxClassifierLoss/classification_loss",
),
)

return model
Loading

0 comments on commit b013f6c

Please sign in to comment.