zzh8829 / yolov3-tf2

YoloV3 Implemented in Tensorflow 2.0
MIT License
2.51k stars 909 forks source link

Custom Dataset Shape Incorrect #355

Open k-macdonald opened 3 years ago

k-macdonald commented 3 years ago

I'm loading in my own data via the tfrecords file. First, I am getting the error:

ValueError: Input 0 is incompatible with layer yolov3: expected shape=(None, 416, 416, 3), found shape=(416, 416, 3)

So, I went into the dataset.py file and added the last line here into the parse_tfrecord() function:

x = tf.io.parse_single_example(tfrecord, IMAGE_FEATURE_MAP) x_train = tf.image.decode_png(x['image/encoded'], channels=3) x_train = tf.image.resize(x_train, (size, size)) x_train = x_train[None,:,:,:]

Which then leads to the error from models.py, line 298:

ValueError: can't split axis of size 5 into pieces of size [4,1,1] for '{{node yolo_loss/split_1}} = SplitV[T=DT_FLOAT, Tlen=DT_INT32, num_split=3](IteratorGetNext:1, yolo_loss/Const_1, yolo_loss/split_1/split_dim)' with input shapes: [?,5], [3], [] and with computed input tensors: input[1] = <4 1 1>, input[2] = <-1>.

Has anyone bumped into this at all? I'm using Tensorflow 2.4.1. Thanks so much!!

RafaelVieira99 commented 2 years ago

have you found a solution yet?