Skip to content

Instantly share code, notes, and snippets.

@pythonlessons
Created August 19, 2020 17:15
Show Gist options
  • Select an option

  • Save pythonlessons/64e1f5a0d4eab7379cd976f8d10dd69f to your computer and use it in GitHub Desktop.

Select an option

Save pythonlessons/64e1f5a0d4eab7379cd976f8d10dd69f to your computer and use it in GitHub Desktop.
Convert_to_pb
import tensorflow as tf
from yolov3.yolov4 import Create_Yolo
from yolov3.utils import load_yolo_weights
from yolov3.configs import *
if YOLO_TYPE == "yolov4":
Darknet_weights = YOLO_V4_TINY_WEIGHTS if TRAIN_YOLO_TINY else YOLO_V4_WEIGHTS
if YOLO_TYPE == "yolov3":
Darknet_weights = YOLO_V3_TINY_WEIGHTS if TRAIN_YOLO_TINY else YOLO_V3_WEIGHTS
yolo = Create_Yolo(input_size=YOLO_INPUT_SIZE)
if YOLO_CUSTOM_WEIGHTS == False:
load_yolo_weights(yolo, Darknet_weights) # use Darknet weights
else:
yolo.load_weights(YOLO_CUSTOM_WEIGHTS) # use custom weights
yolo.summary()
yolo.save(f'./checkpoints/{YOLO_TYPE}-{YOLO_INPUT_SIZE}')
print(f"model saves to /checkpoints/{YOLO_TYPE}-{YOLO_INPUT_SIZE}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment