TensorFlow2.0-Examples icon indicating copy to clipboard operation
TensorFlow2.0-Examples copied to clipboard

How to train a model with or own data?

Open aHandToHelp opened this issue 5 years ago • 4 comments

Hi, Thanks for sharing your amaizing work!

I want to know a few things about your implementation of Yolo V3 on TF2

  1. How we traing the model if we want another size? like 608 or 1056. Change the __C.TRAIN.INPUT_SIZE in config is enogth? or should we recalculate anything else?
  2. Can we transfer learning from other pre trained model? Or always is from scratch?

I tried to train it, but get the nan value on loss after ~4000 steps

=> STEP 4051   lr: 0.000979   giou_loss: 3.13   conf_loss: 5.88   prob_loss: 0.88   total_loss: 9.89
=> STEP 4052   lr: 0.000978   giou_loss:  nan   conf_loss: 8.29   prob_loss: 1.40   total_loss:  nan
=> STEP 4053   lr: 0.000978   giou_loss:  nan   conf_loss:  nan   prob_loss:  nan   total_loss:  nan

Also, when i tried to test my model i got this error:

conv_weights = conv_weights.reshape(conv_shape).transpose([2, 3, 1, 0])
ValueError: cannot reshape array of size 4814 into shape (64,32,3,3)

Should i make some kind of action before test my model? should i load the weight by the .index file?

aHandToHelp avatar Oct 08 '19 16:10 aHandToHelp

In the README you say:

Finally, you can train it and then evaluate your model

$ python train.py
$ tensorboard --logdir ./data/log
$ python test.py
$ cd ../mAP
$ python main.py        # Detection images are expected to save in `YOLOV3/data/detection`

I got this error: The system cannot find the path specified: '../mAP/predicted' so i changed the '../' to './' and works

But then you say: python main.py And there is no main.py anywhere.

aHandToHelp avatar Oct 08 '19 23:10 aHandToHelp

the path of "mAP" is "\TensorFlow2.0-Examples-master\4-Object_Detection\mAP" the path of "YOLOV3" is "\TensorFlow2.0-Examples-master\4-Object_Detection\YOLOV3"

so we'd better copy the entire "4-Object_Detection" folder, also we can new a folder ingcluding "4-Object_Detection\mAP" and "4-Object_Detection\YOLOV3".

orange-dragon avatar May 02 '20 07:05 orange-dragon

But then you say: python main.py And there is no main.py anywhere.

Hi,I found the same problem, How did you solve it? Can you help me? Thanks

dengss33 avatar Oct 10 '20 01:10 dengss33

  1. Can we transfer learning from other pre trained model? Or always is from scratch?

I tried to train it, but get the nan value on loss after ~4000 steps

=> STEP 4051   lr: 0.000979   giou_loss: 3.13   conf_loss: 5.88   prob_loss: 0.88   total_loss: 9.89
=> STEP 4052   lr: 0.000978   giou_loss:  nan   conf_loss: 8.29   prob_loss: 1.40   total_loss:  nan
=> STEP 4053   lr: 0.000978   giou_loss:  nan   conf_loss:  nan   prob_loss:  nan   total_loss:  nan

Hi, so I was training my custom data, and I got the same error, the model starts to give nan error after some epochs? what can be the issue? What should I do?

varunjain3 avatar Dec 12 '20 18:12 varunjain3