ValueError: Layer #232 (named "fpn_cells/cell_0/fnode0/add") expects 0 weight(s) , but the saved weights have 1 element(s)

Issue

I’ve been trying to train dataset using

python train.py --snapshot efficientdet-d0.h5 --phi 0 --gpu 0 --random-transform --compute-val-loss --freeze-backbone --batch-size 4 --steps 100 coco C:/Users/mustafa/Downloads/deneme.v1-1.coco/datasets/coco

And I’ve seen this error.

Traceback (most recent call last):
File "train.py", line 381, in
main()
File "train.py", line 333, in main
model.load_weights(args.snapshot, by_name=True)
File "C:\Users\mustafa\anaconda3\lib\site-packages\tensorflow\python\keras\eng
ine\training.py", line 271, in load_weights
return super(Model, self).load_weights(filepath, by_name, skip_mismatch)
File "C:\Users\mustafa\anaconda3\lib\site-packages\tensorflow\python\keras\eng
ine\network.py", line 1276, in load_weights
f, self.layers, skip_mismatch=skip_mismatch)
File "C:\Users\mustafa\anaconda3\lib\site-packages\tensorflow\python\keras\sav
ing\hdf5_format.py", line 769, in load_weights_from_hdf5_group_by_name
str(len(weight_values)) + ' element(s).')
ValueError: Layer #232 (named "fpn_cells/cell_0/fnode0/add") expects 0 weight(s)
, but the saved weights have 1 element(s).

I’ve tried to set

weighted_bifpn = False

and

os.environ['CUDA_VISIBLE_DEVICES'] = ''

but they didn’t work.
My GPU doesn’t support CUDA.

Solution

you should include –weighted-bifpn option in the command like shown below.

python train.py --snapshot efficientdet-d0.h5 --phi 0 --gpu 0 --weighted-bifpn --random-transform --compute-val-loss --freeze-backbone --batch-size 4 --steps 100 coco C:/Users/mustafa/Downloads/deneme.v1-1.coco/datasets/coco

The snapshot you are using have propbably been trained with the weighted-bifpn. So when you start the trainig it expects this option.

Answered By – Naveen Kumar

Answer Checked By – Robin (AngularFixing Admin)

Leave a Reply

Your email address will not be published.