ultralytics / yolov5

YOLOv5 🚀 in PyTorch > ONNX > CoreML > TFLite
https://docs.ultralytics.com
GNU Affero General Public License v3.0
51.15k stars 16.43k forks source link

TF.js export bug #9534

Closed unnellu closed 2 years ago

unnellu commented 2 years ago

Search before asking

YOLOv5 Component

Other

Bug

24 hours ago train we normal convert, !python export.py --weights runs/train/exp/weights/best.pt --include tfjs

but after 24 hours we have this error

TensorFlow.js: starting export with tensorflowjs 3.20.0... Traceback (most recent call last): File "/usr/local/bin/tensorflowjs_converter", line 8, in sys.exit(pip_main()) File "/usr/local/lib/python3.7/dist-packages/tensorflowjs/converters/converter.py", line 827, in pip_main main([' '.join(sys.argv[1:])]) File "/usr/local/lib/python3.7/dist-packages/tensorflowjs/converters/converter.py", line 831, in main convert(argv[0].split(' ')) File "/usr/local/lib/python3.7/dist-packages/tensorflowjs/converters/converter.py", line 818, in convert weight_shard_size_bytes, metadata_map) File "/usr/local/lib/python3.7/dist-packages/tensorflowjs/converters/converter.py", line 588, in _dispatch_converter metadata=metadata_map) File "/usr/local/lib/python3.7/dist-packages/tensorflowjs/converters/tf_saved_model_conversion_v2.py", line 522, in convert_tf_frozen_model graph = load_graph(frozen_model_path) File "/usr/local/lib/python3.7/dist-packages/tensorflowjs/converters/tf_saved_model_conversion_v2.py", line 68, in load_graph graph_def.ParseFromString(f.read()) File "/usr/local/lib/python3.7/dist-packages/tensorflow/python/lib/io/file_io.py", line 114, in read self._preread_check() File "/usr/local/lib/python3.7/dist-packages/tensorflow/python/lib/io/file_io.py", line 77, in _preread_check compat.path_to_str(self.__name), 1024 * 512) tensorflow.python.framework.errors_impl.NotFoundError: runs/train/exp/weights/best.pb; No such file or directory TensorFlow.js: export failure ❌ 8.3s: [Errno 2] No such file or directory: 'runs/train/exp/weights/best_web_model/model.json' adding: runs/train/exp/weights/best_web_model/ (stored 0%)

For this branch normal work convert !git clone --branch 'exp/scaleFill' https://github.com/ultralytics/yolov5 # clone

Environment

YOLOv5 🚀 v6.2-153-g6f02847 Python-3.7.14 torch-1.12.1+cu113 CUDA:0 (Tesla P100-PCIE-16GB, 16281MiB) Setup complete ✅ (4 CPUs, 25.5 GB RAM, 37.4/166.8 GB disk)

Minimal Reproducible Example

No response

Additional

No response

Are you willing to submit a PR?

glenn-jocher commented 2 years ago

@unnellu thanks for the bug report! I'm able to reproduce, I'll add a TODO to prioritize a fix for this.