Closed geek1111 closed 7 years ago
@vimalvnair @Vignesh1115 ☝️
Hi @geek1111, We're working on this, will be posting an update in an hour.
Hi @geek1111, I've observed that you terminated the training. You have encountered a warning and not an error. This is entirely normal and expected, please let the training proceed. Also please make sure to add a folder called optimized_thetas
. Can you let me know if you were able to generate the trained model?
@geek1111, The model https://s3.amazonaws.com/multunus-machine-learning/model_2016-07-20_19-38-07_l0.05_h114.pkl had keys named incorrectly. Instead of optimized_theta
the key in the dictionary was named optim_theta
. I have uploaded the corrected model, please download and use this model using the same link.
after running "python train.py 0.1 60" its shows following error note : i have stored all images in their respective folders without renaming images.
Loading images to array...
Traceback (most recent call last):
File "train.py", line 116, in
@geek1111 Can you let me know what's the OS you are using? That'll help us in possibly replicating this issue.
@geek1111, I also noticed that the timestamp in the filename of image mentioned above - 1486294885 is equivalent to Feb 5, 2017 @ 11:41am (UTC). I think these images have been generated by you, if that's the case can you also confirm that this code snippet works correctly for you?
from scipy.misc import imread
imread("./forward/image-forward-1486294885.89.jpg", flatten=True)
Hi @Vignesh1115 , I'm using Raspbian jessie with pixel created "imread.py" file in same directory and tried to run given code it shows following error.
Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/scipy/misc/pilutil.py", line 126, in imread im = Image.open(name) File "/usr/lib/python2.7/dist-packages/PIL/Image.py", line 2288, in open % (filename if filename else fp)) IOError: cannot identify image file './forward/image-forward-1486294885.89.jpg'
Hi @geek1111, We had faced this issue with corrupted images while training the model. Can you confirm that you can view the image in any image viewer?
Also, we'd like to suggest that you train the model on a PC instead of the Raspberry Pi and then upload the trained model to the optimized_thetas
folder before running autonomous.py
.
Hi @Vignesh1115, We tried to open that images with image viewer and images opening without any problem. still i'm gonna try on Ubuntu. On which environment you're training your model ?
Hi @geek111
We trained our models in an Ubuntu machine. Can you please send us the image you tried to open(image-forward-1486294885.89.jpg).
Thanks
hi @Vignesh1115 & @vimalvnair ,
Unfortunately @vimalvnair those images are deleted by me...as per @Vignesh1115 while collecting new images we found some images are corrupted i'd deleted corrupted images and then kept in their respective
folders (new images) and from terminal we run train.py 0.1 60
then it's showing some Run-time warnings.
Loading images to array...
/home/pi/Desktop/auto1/sigmoid.py:8: RuntimeWarning: overflow encountered in power
return 1/(1 + power(e, -x_value))
/home/pi/Desktop/auto1/cost_function.py:32: RuntimeWarning: divide by zero encountered in log
second_part_of_cost = ((1.0 - y_values) * numpy.log(1.0-output))
/home/pi/Desktop/auto1/cost_function.py:32: RuntimeWarning: invalid value encountered in multiply
second_part_of_cost = ((1.0 - y_values) * numpy.log(1.0-output))
/home/pi/Desktop/auto1/cost_function.py:31: RuntimeWarning: divide by zero encountered in log
first_part_of_cost = -((y_values) * numpy.log(output))
/home/pi/Desktop/auto1/cost_function.py:31: RuntimeWarning: invalid value encountered in multiply
first_part_of_cost = -((y_values) * numpy.log(output))
82.4851013856
{'warnflag': 0, 'task': 'CONVERGENCE: REL_REDUCTION_OF_F_<=_FACTR*EPSMCH', 'grad': array([ 1.01515745e-12, 1.78727601e-06, 4.37145773e-06, ...,
-1.38048147e-02, 7.42514133e-03, -1.68046946e-02]), 'nit': 41, 'funcalls': 203}
----------------------------------------------------------end--------------------------------------------------------
After getting .pkl
file in optimized_thetas
shows following error when we run autonomous.py
note : changed key as optim_theta
in predict.py
still its showing keyerror.
./optimized_thetas/model_2017-02-08_20-41-17_l0.1_h60.pkl
Traceback (most recent call last):
File "/home/pi/Desktop/auto1/autonomous.py", line 92, in <module>
main()
File "/home/pi/Desktop/auto1/autonomous.py", line 89, in main
autonomous_control(model)
File "/home/pi/Desktop/auto1/autonomous.py", line 14, in autonomous_control
predictor = Predictor(model)
File "/home/pi/Desktop/auto1/predict.py", line 23, in __init__
self._open_model_file(model_file)
File "/home/pi/Desktop/auto1/predict.py", line 28, in _open_model_file
self.thetas = self.model['optim_theta']
KeyError: 'optim_theta'
Hi @geek1111,
The save_model
function in train.py
generates a model with the following structure:
{'optimized_theta': array([ 0. , 0.40015721, 0.97873798, ..., -2.7505016 ,
0.91829395, -0.26910487]), 'hidden_layer_size': 110, 'lambda_value': 0.1}
The Predictor
class in predict.py
expects the trained model to have the keys optimized_theta
, hidden_layer_size
and lambda_value
.
If you change the key back to optimized_theta
in _open_model_file of predict.py
, you should be able to use the trained model.
Please note that the model we had uploaded earlier was generated using an older version of the code and had keys named incorrectly. We had fixed that and uploaded the correct model a few days ago. Before that, the Predictor
class was expecting a key name optimized_theta
but the uploaded model had a key named optim_theta
. After you changed the key to optim_theta
in predict.py
, the Predictor
class now expects a key named optim_theta
but the train.py
generates models with the key optimized_theta
.
hi @Vignesh1115 We changed key back to optimized_theta
in predict.py
it's working now! thank you so much you and your team for your immediate support , When you're planning to add planned features
?
Hi @geek1111, I'm very happy to hear that the issue is resolved. Thanks for your patience throughout our conversations. Your kind words mean a lot to us. We do not have any immediate plans to work on those features but if you are keen on taking up parts of the planned features, we can help you. Let me know if you need help with anything. I will be closing this issue now.
When I trained the .pkl file with my training images the predictions were wrong.
Then I tried your training images and then trained it still the predictions were wrong.
I got your .pkl from "https://s3.amazonaws.com/multunus-machine-learning/model_2016-07-20_19-38-07_l0.05_h114.pkl."
This .pkl file did worked . So are u training your .pkl file on different parameters or something else differs from mine ?? I see ur lamda value is 0.05 and hidden layer size is 114 from the name of your .pkl file . I even tried the same parameters and still predicitons are wrong .... Any solutions ??
-Thanks in advance
@Vignesh1115 @vimalvnair .
Hi @swapnillubal, We trained the model with numerous images which were captured under a variety of lighting conditions. The conditions under which you may be training might be different.
I would like to suggest the following approach to training your own model. Create a large dataset and split it into a training set
, cross-validation set
and test set
. Ensure that there are no images common across these sets. You can follow a 60-20-20 split. Now train all your models with varying values for lambda
and the hidden layer size
. Once you have completed the training of these individual models, you can calculate the error rates
on the validation set
and shortlist the ones with the best performance to evaluate the error rates
on the test set
. The values of lambda
and the hidden layer size
should be chosen with care to prevent the network from overfitting/underfitting the data. The network will underfit for large values of lambda
and small values of the hidden layer size
. Similarly, lower values of lambda
and large values of the hidden layer size
cause the network to overfit the data and will start incorporating noise into the model. I've not seen examples where the regularisation parameter(lambda
) is more than 0.1. The rule of the thumb for the number of nodes in the hidden layer is that they are usually between the size of the input layer and the size of the output layer. You could maintain the value of lambda
below 0.1 and vary the hidden layer size
while performing cross-validation to determine optimal values for these hyperparameters.
You can reach us on Gitter if you need help with this.
Loading images to array... /home/pi/Desktop/auto1/sigmoid.py:7: RuntimeWarning: overflow encountered in power return 1.0/(1.0 + power(e, -x_value) I'm getting the above error
I pasted the images u gave from dataset i.e https://s3.amazonaws.com/multunus-machine-learning/autonomous-rc-car-data-set.tar.gz .....but its giving error -----------------------------start---------------------------------------------------------------- Loading images to array... /home/pi/Desktop/auto1/sigmoid.py:7: RuntimeWarning: overflow encountered in power return 1.0/(1.0 + power(e, -x_value)) ^CTraceback (most recent call last): File "train.py", line 116, in
main()
File "train.py", line 109, in main
function_parameters)
File "train.py", line 72, in minimize_cost_function
fprime=gradients_wrapper, args=[function_parameters])
File "/usr/lib/python2.7/dist-packages/scipy/optimize/lbfgsb.py", line 186, in fmin_l_bfgs_b
*opts)
File "/usr/lib/python2.7/dist-packages/scipy/optimize/lbfgsb.py", line 314, in _minimize_lbfgsb
f, g = func_and_grad(x)
File "/usr/lib/python2.7/dist-packages/scipy/optimize/lbfgsb.py", line 266, in func_and_grad
g = jac(x, args)
File "train.py", line 37, in gradients_wrapper
return gradients(gradient_parameters)
File "/home/pi/Desktop/auto1/cost_function.py", line 59, in gradients
hidden_layerinput = numpy.c[numpy.ones(input_examples_size), x_values].dot(theta_1.T)
File "/usr/lib/python2.7/dist-packages/numpy/lib/index_tricks.py", line 326, in getitem
res = _nx.concatenate(tuple(objs), axis=self.axis)
-----------------------------------------------end-----------------------------------------
Then i got your trained model from https://s3.amazonaws.com/multunus-machine-learning/model_2016-07-20_19-38-07_l0.05_h114.pkl. and then executed it but it still gives error note: i renamed the downloaded .pkl file as model.pkl -----------------------------------start---------------------------------------------------- ./optimized_thetas/model.pkl
Traceback (most recent call last): File "autonomous.py", line 92, in
main()
File "autonomous.py", line 89, in main
autonomous_control(model)
File "autonomous.py", line 14, in autonomous_control
predictor = Predictor(model)
File "/home/pi/Desktop/auto1/predict.py", line 23, in init
self._open_model_file(model_file)
File "/home/pi/Desktop/auto1/predict.py", line 28, in _open_model_file
self.thetas = self.model['optimized_theta']
KeyError: 'optimized_theta'
----------------------------------------end----------------------------------------------------
need help in it pls ASAP