-
-
Notifications
You must be signed in to change notification settings - Fork 17.2k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
🐛 Bug
Can't build TF saved_model or tflite with new v6
To Reproduce (REQUIRED)
Run the google colab- only need to run the below block:
# CI Checks
%%shell
export PYTHONPATH="$PWD" # to run *.py. files in subdirectories
rm -rf runs # remove runs/
for m in yolov5s; do # models
python train.py --weights $m.pt --epochs 3 --img 320 --device 0 # train pretrained
python train.py --weights '' --cfg $m.yaml --epochs 3 --img 320 --device 0 # train scratch
for d in 0; do # cpu; do # devices
python detect.py --weights $m.pt --device $d # detect official
python detect.py --weights runs/train/exp/weights/best.pt --device $d # detect custom
python val.py --weights $m.pt --device $d # val official
python val.py --weights runs/train/exp/weights/best.pt --device $d # val custom
done
python hubconf.py # hub
python models/yolo.py --cfg $m.yaml # build PyTorch model
python models/tf.py --weights $m.pt # build TensorFlow model
python export.py --img 128 --batch 1 --weights $m.pt --include tflite #torchscript onnx # export
done
output:
missing SPPF in tf.py
Environment
google colab + gpu
Some debug:
For start the SPPF is missing from tf.py
:
from models.common import Conv, Bottleneck, SPP, DWConv, Focus, BottleneckCSP, Concat, autopad, C3, **SPPF**
...
class TFSPPF(keras.layers.Layer):
# Spatial pyramid pooling-Fast layer
def __init__(self, c1, c2, k=5, w=None):
super(TFSPPF, self).__init__()
c_ = c1 // 2 # hidden channels
self.cv1 = TFConv(c1, c_, 1, 1, w=w.cv1)
self.cv2 = TFConv(c_ * 4, c2, 1, 1, w=w.cv2)
self.m = keras.layers.MaxPool2D(pool_size=k, strides=1, padding='SAME')
def call(self, inputs):
x = self.cv1(inputs)
y1 = self.m(x)
y2 = self.m(y1)
return self.cv2(tf.concat([x, y1, y2, self.m(y2)], 3))
After building the TFSPPF class we are still getting this new error:
Eager execution of tf.constant with unsupported shape (value has 131072 elements, shape is (1, 1, 512, 512) with 262144 elements)
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working