Skip to content

Commit

Permalink
Add check_file(data) i.e. --data coco128.yaml (ultralytics#8851)
Browse files Browse the repository at this point in the history
* Add check_file(data) i.e. `--data coco128.yaml`

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
2 people authored and Clay Januhowski committed Sep 8, 2022
1 parent be5626c commit dff15d5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions export.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@
from models.experimental import attempt_load
from models.yolo import Detect
from utils.dataloaders import LoadImages
from utils.general import (LOGGER, check_dataset, check_img_size, check_requirements, check_version, colorstr,
file_size, print_args, url2file)
from utils.general import (LOGGER, check_dataset, check_file, check_img_size, check_requirements, check_version,
colorstr, file_size, print_args, url2file)
from utils.torch_utils import select_device


Expand Down Expand Up @@ -490,7 +490,7 @@ def export_tflite(keras_model, im, file, int8, data, nms, agnostic_nms, prefix=c
converter.optimizations = [tf.lite.Optimize.DEFAULT]
if int8:
from models.tf import representative_dataset_gen
dataset = LoadImages(check_dataset(data)['train'], img_size=imgsz, auto=False) # representative data
dataset = LoadImages(check_dataset(check_file(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]
converter.target_spec.supported_types = []
Expand Down

0 comments on commit dff15d5

Please sign in to comment.