Commit 0bc599e7 authored by Kaushik Shivakumar's avatar Kaushik Shivakumar
Browse files

flip around similarity calculation

parent 1ed7ef39
......@@ -104,9 +104,10 @@ class DETRSimilarity(RegionSimilarityCalculator):
classification_scores = tf.matmul(groundtruth_labels,
predicted_labels,
transpose_b=True)
return -self.l1_weight * box_list_ops.l1(
boxlist1, boxlist2) + self.giou_weight * box_list_ops.giou(
boxlist1, boxlist2) + classification_scores
loss = self.l1_weight * box_list_ops.l1(
boxlist1, boxlist2) + self.giou_weight * (1 - box_list_ops.giou(
boxlist1, boxlist2)) - classification_scores
return -loss
class NegSqDistSimilarity(RegionSimilarityCalculator):
......
# Faster R-CNN with Resnet-50 (v1) with 640x640 input resolution
# Trained on COCO, initialized from Imagenet classification checkpoint
# This config is TPU compatible.
model {
detr {
num_classes: 37
image_resizer {
keep_aspect_ratio_resizer {
min_dimension: 450 #640
max_dimension: 450 #640
pad_to_max_dimension: true
}
}
feature_extractor {
type: 'detr_resnet50_keras'
batch_norm_trainable: true
}
post_processing {
score_converter: SOFTMAX
}
giou_localization_loss_weight: 1.0
l1_localization_loss_weight: 1.0
classification_loss_weight: 1.0
use_matmul_gather_in_matcher: true
}
}
train_config: {
batch_size: 64
sync_replicas: true
startup_delay_steps: 0
replicas_to_aggregate: 8
num_steps: 25000
optimizer {
adam_optimizer {
learning_rate {
manual_step_learning_rate {
initial_learning_rate: 0.0000
schedule {
step: 2000
learning_rate: 0.0001
}
schedule {
step: 35000
learning_rate: 0.0001
}
schedule {
step: 40000
learning_rate: 0.00025
}
warmup: true
}
}
}
use_moving_average: false
}
#optimizer {
# momentum_optimizer: {
# learning_rate: {
# manual_step_learning_rate {
# initial_learning_rate: 0.0002
# schedule {
# step: 2000
# learning_rate: 0.0002
# }
# schedule {
# step: 35000
# learning_rate: 0.003
# }
# schedule {
# step: 40000
# learning_rate: 0.00025
# }
# warmup: true
# }
# }
# momentum_optimizer_value: 0.9
# }
# use_moving_average: false
#}
fine_tune_checkpoint_version: V2
fine_tune_checkpoint: "gs://object-detection-dogfood/ava-kaushik/pretrained_checkpoint/resnet50/resnet50.ckpt-1" #"gs://object-detection-dogfood/ava-kaushik/tpu-training2/ckpt-26"
fine_tune_checkpoint_type: "classification"
data_augmentation_options {
random_horizontal_flip {
}
}
max_number_of_boxes: 10
unpad_groundtruth_tensors: false
use_bfloat16: true # works only on TPUs
}
train_input_reader: {
tf_record_input_reader {
input_path: "gs://object-detection-dogfood/ava-kaushik/pets_records/pet_faces_train*"
}
label_map_path: "gs://object-detection-dogfood/ava-kaushik/pet_label_map.pbtxt"
shuffle: false
}
eval_config: {
metrics_set: "coco_detection_metrics"
use_moving_averages: false
batch_size: 1;
max_num_boxes_to_visualize: 100
}
eval_input_reader: {
label_map_path: "gs://object-detection-dogfood/ava-kaushik/pet_label_map.pbtxt"
shuffle: false
num_epochs: 1
tf_record_input_reader {
input_path: "gs://object-detection-dogfood/ava-kaushik/pets_records/pet_faces_val*"
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment