thtrieu / darkflow

Translate darknet to tensorflow. Load trained weights, retrain/fine-tune using tensorflow, export constant graph def to mobile devices
GNU General Public License v3.0
6.13k stars 2.08k forks source link

ValueError: need at least one array to concatenate #1097

Closed Limbomike closed 4 years ago

Limbomike commented 4 years ago

Hey Community,

I am running into the same Problem as the code in issue #373, which is the ValueError because of not finding anything in the list x_batch. The fix from there, with the short code if len(x_batch) == 0: continue helped me.

Still I want to understand why this is happening and how to properly avoid it. If I leave the default epochs of 1000 this problem occurs. The input of my cmd line: python flow --model "01_Computer_Vision\darkflow-master\cfg\yolo2-1c.cfg" --labels labels.txt --train --dataset "01_Computer_Vision\darkflow-master\data\images" --annotation "01_Computer_Vision\darkflow-master\data\annotations" Here some example output from my cmd-line:

Statistics: label1: 91 Dataset size: 4 Dataset of 4 instance(s) Training statistics: Learning rate : 1e-05 Batch size : 4 Epoch number : 1000 Backup every : 2000 step 1 - loss 240.62632751464844 - moving ave loss 240.62632751464844 Finish 1 epoch(es) step 2 - loss 238.95687866210938 - moving ave loss 240.45938262939455 Finish 2 epoch(es) step 3 - loss 237.27024841308594 - moving ave loss 240.14046920776372 Finish 3 epoch(es) step 4 - loss 242.36392211914062 - moving ave loss 240.3628144989014 Finish 4 epoch(es) step 5 - loss 238.1708984375 - moving ave loss 240.14362289276127 Finish 5 epoch(es) step 6 - loss 240.37310791015625 - moving ave loss 240.16657139450075 Finish 6 epoch(es) Traceback (most recent call last): File "flow", line 6, in cliHandler(sys.argv) File "01_Computer_Vision\darkflow-master\darkflow\cli.py", line 33, in cliHandler print('Enter training ...'); tfnet.train() File "01_Computer_Vision\darkflow-master\darkflow\net\flow.py", line 39, in train for i, (x_batch, datum) in enumerate(batches): File "01_Computer_Vision\darkflow-master\darkflow\net\yolo\data.py", line 132, in shuffle x_batch = np.concatenate(x_batch, 0) File "<__array_function__ internals>", line 6, in concatenate ValueError: need at least one array to concatenate

Furthermore I also changed once the epoch to 49, it then worked. Would appreciate the help, if someone knows why this issue is occuring or how to prevent it better than with the above code.

BR

Limbomike commented 4 years ago

I close the issue since nobody is replying.