mirror of
https://github.com/azaion/ai-training.git
synced 2026-04-22 09:06:35 +00:00
add export to tensorrt
This commit is contained in:
@@ -20,6 +20,7 @@ from constants import (processed_images_dir,
|
||||
prefix, date_format,
|
||||
datasets_dir, models_dir,
|
||||
corrupted_images_dir, corrupted_labels_dir, sample_dir)
|
||||
from exports.export import form_data_sample
|
||||
from security import Security
|
||||
from utils import Dotdict
|
||||
|
||||
@@ -209,28 +210,6 @@ def convert2rknn():
|
||||
pass
|
||||
|
||||
|
||||
def form_data_sample(size=300):
|
||||
images = []
|
||||
with scandir(processed_images_dir) as imd:
|
||||
for image_file in imd:
|
||||
if not image_file.is_file():
|
||||
continue
|
||||
images.append(image_file)
|
||||
print('shuffling images')
|
||||
random.shuffle(images)
|
||||
images = images[:size]
|
||||
|
||||
shutil.rmtree(sample_dir, ignore_errors=True)
|
||||
makedirs(sample_dir, exist_ok=True)
|
||||
|
||||
lines = []
|
||||
for image in images:
|
||||
shutil.copy(image.path, path.join(sample_dir, image.name))
|
||||
lines.append(f'./{image.name}')
|
||||
with open(path.join(sample_dir, 'azaion_subset.txt'), 'w', encoding='utf-8') as f:
|
||||
f.writelines([f'{line}\n' for line in lines])
|
||||
|
||||
|
||||
def validate(model_path):
|
||||
model = YOLO(model_path)
|
||||
metrics = model.val()
|
||||
|
||||
Reference in New Issue
Block a user