"tests/vscode:/vscode.git/clone" did not exist on "c480d4e4e213a850cced7758f7b62c20caad8820"
Commit c5826f37 authored by Vishnu Banna's avatar Vishnu Banna
Browse files

addressing ocmments

parent 420594a8
......@@ -665,8 +665,7 @@ def build_darknet(
l2_regularizer: tf.keras.regularizers.Regularizer = None) -> tf.keras.Model:
"""Builds darknet."""
backbone_cfg = backbone_config.backbone.get()
backbone_cfg = backbone_config.get()
model = Darknet(
model_id=backbone_cfg.model_id,
min_level=backbone_cfg.min_level,
......
......@@ -65,7 +65,6 @@ def build_yolo_decoder(input_specs, model_config: yolo.Yolo, l2_regularization):
kernel_regularizer=l2_regularization)
base_model.update(base_dict)
print(base_model)
model = YoloDecoder(input_specs, **base_model)
......@@ -74,14 +73,14 @@ def build_yolo_decoder(input_specs, model_config: yolo.Yolo, l2_regularization):
def build_yolo_filter(model_config: yolo.Yolo, decoder: YoloDecoder, masks,
xy_scales, path_scales):
def _build(values):
print(values)
"""Used to make model cfg shorter when different FPN lvls require
different hyper paramters while others do not. The term all will
blanket set the same hyper paramter for all FPN levels."""
if "all" in values and values["all"] is not None:
for key in values:
if key != 'all':
values[key] = values["all"]
print(values)
return values
model = YoloLayer(
......@@ -125,12 +124,7 @@ def build_yolo_head(input_specs, model_config: yolo.Yolo, l2_regularization):
def build_yolo(input_specs, model_config, l2_regularization, masks, xy_scales,
path_scales):
print(model_config.as_dict())
print(input_specs)
print(l2_regularization)
# backbone = factory.build_backbone(input_specs, model_config,
# l2_regularization)
backbone = build_darknet(input_specs, model_config,
l2_regularization)
decoder = build_yolo_decoder(backbone.output_specs, model_config,
......
"""Contains common building blocks for yolo neural networks."""
"""Contains common building blocks for yolo neural networtf.keras."""
import tensorflow as tf
import tensorflow.keras as ks
import tensorflow.keras.backend as K
from official.vision.beta.projects.yolo.ops import box_ops
@ks.utils.register_keras_serializable(package='yolo')
class YoloLayer(ks.Model):
@tf.keras.utils.register_keras_serializable(package='yolo')
class YoloLayer(tf.keras.Model):
def __init__(self,
masks,
......@@ -134,9 +133,6 @@ class YoloLayer(ks.Model):
self._nms_type = self._nms_types[nms_type]
if self._nms_type >= 2 and self._nms_type <= 5:
self._nms = nms_ops.TiledNMS(iou_type=nms_type)
self._scale_xy = scale_xy or {key: 1.0 for key, _ in masks.items()}
self._generator = {}
......
......@@ -15,17 +15,14 @@
# ==============================================================================
"""Tests for yolo."""
# Import libraries
from absl.testing import parameterized
import numpy as np
import tensorflow as tf
from tensorflow.python.distribute import combinations
from tensorflow.python.distribute import strategy_combinations
# from official.vision.beta.projects.yolo.modeling.backbones import darknet
from official.vision.beta.projects.yolo.modeling.layers import detection_generator as dg
class YoloDecoderTest(parameterized.TestCase, tf.test.TestCase):
@parameterized.parameters(
......@@ -61,6 +58,6 @@ class YoloDecoderTest(parameterized.TestCase, tf.test.TestCase):
if __name__ == '__main__':
from yolo.utils.run_utils import prep_gpu
prep_gpu()
# from yolo.utils.run_utils import prep_gpu
# prep_gpu()
tf.test.main()
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