Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions rfdetr/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ def lr_lambda(current_step: int):
for callback in callbacks["on_train_end"]:
callback()

def export(self, output_dir="output", infer_dir=None, simplify=False, backbone_only=False, opset_version=17, verbose=True, force=False, shape=None, batch_size=1, **kwargs):
def export(self, output_dir="output", infer_dir=None, simplify=False, backbone_only=False, opset_version=17, verbose=True, force=False, batch_size=1, **kwargs):
"""Export the trained model to ONNX format"""
print(f"Exporting model to ONNX format")
try:
Expand All @@ -532,11 +532,7 @@ def export(self, output_dir="output", infer_dir=None, simplify=False, backbone_

os.makedirs(output_dir, exist_ok=True)
output_dir = Path(output_dir)
if shape is None:
shape = (self.resolution, self.resolution)
else:
if shape[0] % 14 != 0 or shape[1] % 14 != 0:
raise ValueError("Shape must be divisible by 14")
shape = (self.resolution, self.resolution)

input_tensors = make_infer_image(infer_dir, shape, batch_size, device).to(device)
input_names = ['input']
Expand Down