第一次调试

This commit is contained in:
552068321@qq.com
2022-11-07 14:34:35 +08:00
parent 6f7de660aa
commit 41ba5d9f44
23 changed files with 2023 additions and 152 deletions

View File

@ -64,12 +64,12 @@ if str(ROOT) not in sys.path:
if platform.system() != 'Windows':
ROOT = Path(os.path.relpath(ROOT, Path.cwd())) # relative
from models.experimental import attempt_load
from models.yolo import ClassificationModel, Detect
from utils.dataloaders import LoadImages
from utils.general import (LOGGER, Profile, check_dataset, check_img_size, check_requirements, check_version,
from app.yolov5.models.experimental import attempt_load
from app.yolov5.models.yolo import ClassificationModel, Detect
from app.yolov5.utils.dataloaders import LoadImages
from app.yolov5.utils.general import (LOGGER, Profile, check_dataset, check_img_size, check_requirements, check_version,
check_yaml, colorstr, file_size, get_default_args, print_args, url2file)
from utils.torch_utils import select_device, smart_inference_mode
from app.yolov5.utils.torch_utils import select_device, smart_inference_mode
def export_formats():
@ -309,7 +309,7 @@ def export_saved_model(model,
import tensorflow as tf
from tensorflow.python.framework.convert_to_constants import convert_variables_to_constants_v2
from models.tf import TFModel
from app.yolov5.models.tf import TFModel
LOGGER.info(f'\n{prefix} starting export with tensorflow {tf.__version__}...')
f = str(file).replace('.pt', '_saved_model')
@ -371,7 +371,7 @@ def export_tflite(keras_model, im, file, int8, data, nms, agnostic_nms, prefix=c
converter.target_spec.supported_types = [tf.float16]
converter.optimizations = [tf.lite.Optimize.DEFAULT]
if int8:
from models.tf import representative_dataset_gen
from app.yolov5.models.tf import representative_dataset_gen
dataset = LoadImages(check_dataset(check_yaml(data))['train'], img_size=imgsz, auto=False)
converter.representative_dataset = lambda: representative_dataset_gen(dataset, ncalib=100)
converter.target_spec.supported_ops = [tf.lite.OpsSet.TFLITE_BUILTINS_INT8]