Skip to content

Commit

Permalink
Remove sample_conv as layer do not exist when users are building for …
Browse files Browse the repository at this point in the history
…custom models
  • Loading branch information
Raphael Meudec committed Aug 6, 2020
1 parent 2eeb08d commit 0a4cab3
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions tf2_yolov4/tools/weights.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ def load_darknet_weights_in_yolo(yolo_model, darknet_weights_path):
Returns:
tf.keras.Model: YOLOv4 model with Darknet weights loaded.
"""
sample_conv_weights = (
yolo_model.get_layer("CSPDarknet53").get_layer("conv2d_32").get_weights()[0]
)

model_layers = (
yolo_model.get_layer("CSPDarknet53").layers
+ yolo_model.get_layer("YOLOv4_neck").layers
Expand Down Expand Up @@ -108,17 +104,6 @@ def load_darknet_weights_in_yolo(yolo_model, darknet_weights_path):
darknet_weight_file.close()
assert remaining_chars == 0

# Check if weights have been updated
sample_conv_weights_after_loading = (
yolo_model.get_layer("CSPDarknet53").get_layer("conv2d_32").get_weights()[0]
)
np.testing.assert_raises(
AssertionError,
np.testing.assert_array_equal,
sample_conv_weights,
sample_conv_weights_after_loading,
)

return yolo_model


Expand Down

0 comments on commit 0a4cab3

Please sign in to comment.