mirror of
https://github.com/azaion/ai-training.git
synced 2026-04-22 09:06:35 +00:00
add download big engine file to cdn manager
revise onnx export process fixes
This commit is contained in:
@@ -7,12 +7,13 @@ from datetime import datetime
|
||||
from os import path, replace, listdir, makedirs, scandir
|
||||
from os.path import abspath
|
||||
from pathlib import Path
|
||||
from time import sleep
|
||||
|
||||
import yaml
|
||||
from ultralytics import YOLO
|
||||
|
||||
import constants
|
||||
from azaion_api import ApiCredentials, Api
|
||||
from api_client import ApiCredentials, ApiClient
|
||||
from cdn_manager import CDNCredentials, CDNManager
|
||||
from constants import (processed_images_dir,
|
||||
processed_labels_dir,
|
||||
@@ -20,10 +21,11 @@ from constants import (processed_images_dir,
|
||||
datasets_dir, models_dir,
|
||||
corrupted_images_dir, corrupted_labels_dir, sample_dir)
|
||||
from dto.annotationClass import AnnotationClass
|
||||
from inference.onnx_engine import OnnxEngine
|
||||
|
||||
from security import Security
|
||||
from utils import Dotdict
|
||||
from exports import export_tensorrt, upload_model
|
||||
from exports import export_tensorrt, upload_model, export_onnx
|
||||
|
||||
today_folder = f'{prefix}{datetime.now():{date_format}}'
|
||||
today_dataset = path.join(datasets_dir, today_folder)
|
||||
@@ -224,10 +226,11 @@ if __name__ == '__main__':
|
||||
# validate(path.join('runs', 'detect', 'train7', 'weights', 'best.pt'))
|
||||
# form_data_sample(500)
|
||||
# convert2rknn()
|
||||
model_path = 'azaion.pt'
|
||||
export_tensorrt(model_path)
|
||||
engine_model_path = f'{Path(model_path).stem}.engine'
|
||||
upload_model(engine_model_path, engine_model_path)
|
||||
api_client = ApiClient()
|
||||
onnx_path = export_onnx('azaion.pt')
|
||||
|
||||
onnx_model_path = f'{Path(model_path).stem}.onnx'
|
||||
upload_model(onnx_model_path, onnx_model_path)
|
||||
with open(onnx_path, 'rb') as binary_file:
|
||||
onnx_bytes = binary_file.read()
|
||||
|
||||
key = Security.get_model_encryption_key()
|
||||
api_client.upload_big_small_resource(onnx_bytes, onnx_path, constants.MODELS_FOLDER, key)
|
||||
|
||||
Reference in New Issue
Block a user