multunus / autonomous-rc-car Goto Github PK
View Code? Open in Web Editor NEWAutonomous RC car using Raspberry Pi and ANN
License: MIT License
Autonomous RC car using Raspberry Pi and ANN
License: MIT License
I have trained model with following inputs
python train.py 0.1 60
python train.py 0.5 114
python train.py 0.5 90
but car remains idle it doesn't move forward, left, right it just stays idle.....
I'm doing something wrong?
you can download file here
Why PyGame is not working in my Raspberry PI!?
` while True:
for event in pygame.event.get():
if event.type in {pygame.K_q, pygame.K_ESCAPE}:
print "Bye"
elif event.type in {pygame.KEYDOWN, pygame.KEYUP}:
print "Key pressed"
if event.type == pygame.KEYUP:
print "UP"`
This is my Sample Code ! Actually it shows in terminal just random texts rather than UP
Thanks in Advance
in the setup section. The images for training are captured using interactive_control_train.py, the car can't be controlled using the direction arrows..
I am getting this error while running " python train.py 0.1 100 " , even I tried with 60 instead of 100 . same error is repeating.
autonomous-rc-car-master/sigmoid.py:9: RuntimeWarning: overflow encountered in power
return 1.0/(1.0 + power(e, -x_value))
whenever I run interactive_control_train.py wheels start moving in backward direction. all other controls works fine but wheels keep moving backward and stops when i press forward button and again start moving when i release forward button
When do you plan to add stop signal detection and obstacle detection?
We are getting the following error while executing autonomous.py in RPi 3 Model B v1.2
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 27, in autonomous_control
direction = predictor.predict(stream)
File "/home/pi/test/mu/multunus/predict.py", line 33, in predict
input_layer_size, number_of_labels, x_value = _convert_stream_to_array(stream)
File "/home/pi/test/mu/multunus/predict.py", line 58, in _convert_stream_to_array
resized_image_array = imresize(image_array, IMAGE_DIMENSIONS)
File "/usr/lib/python3/dist-packages/scipy/misc/pilutil.py", line 421, in imresize
im = toimage(arr, mode=mode)
File "/usr/lib/python3/dist-packages/scipy/misc/pilutil.py", line 238, in toimage
raise ValueError("'arr' does not have a suitable array shape for any mode.")
ValueError: 'arr' does not have a suitable array shape for any mode.
What could the mistake from our side???
I am facing UnicodeDecodeError: 'ascii' codec can't decode byte 0x89 in position 9: ordinal not in range(128) error, I have placed the traned module from this same repo in optimized teta folder
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/rcar/predict.py", line 23, in init
self._open_model_file(model_file)
File "/home/pi/Desktop/rcar/predict.py", line 27, in _open_model_file
self.model = pickle.load(mod)
UnicodeDecodeError: 'ascii' codec can't decode byte 0x89 in position 9: ordinal not in range(128)
We are implementing the same project, there is another repo here. As that repo uses the HAAR cascade method to detect traffic signals and stops signs but the issue is that repo uses the client-server method which sacrifices the framerate of cam stream and other processing resources . We needed your help to modify the code and add features of detect sign boards and other stuff.
Traceback (most recent call last):
File "/home/pi/interactive_control_train.py", line 6, in
import configuration
File "/usr/lib/python3/dist-packages/thonny/backend.py", line 305, in _custom_import
module = self._original_import(*args, **kw)
ImportError: No module named 'configuration'
with images without using picamera
hi, i'm learning this project,and i want to get the training data in this program, because it's too waste time to collect training data with manually operate the car, so do you mind to give your training data or upload the training data?
when python interactive_control_train.py,there's no video from camera ,but images can generate into the folder ,what's wrong?
while running the autonomous.py script it gives an error " UnicodeDecodeError: 'ascii' codec cant decode byte 0x89 in position 9: ordinal not in range(128)?
Thanks in advance.
Hello,Sir i'm getting error when i run Train.py.
FileNotFoundError:No such File or Directory: Optimized_thetas/model_2017-05-29_21-08-44_10.0_h50.pkl
hello sir I'm getting runtime error return 1.0/(1.0 + power(e, -x_value))) overflow with power. I have changed different lamda values but of no use and also i have decreased the size of the resolution.
Can you please help me sir....!!
in predict.py
, image stream is cropped before prediction.
def _convert_stream_to_array(stream):
...
image = image.crop((0, PICAMERA_RESOLUTION_HEIGHT / 2, PICAMERA_RESOLUTION_WIDTH, PICAMERA_RESOLUTION_HEIGHT))
...
but in train.py
, it not do the same step in load_images_to_array
, is this a bug?
Did any one implement stop sign and traffic signal by using this code? Let me know please!
Can I have any predefined data sets available Mr.vignesh?
hi, i'm learning this project,I downloaded the dataset-https://s3.amazonaws.com/multunus-machine-learning/autonomous-rc-car-data-set.tar.gz.My computer is not very powerful , can someone or could give a link where we can download a pre-trained model?
Why getting this error?
FileNotFoundError: No such File or Directory: Optimized_thetas/model_2017-06-3_21-08-44_10.0_h50.pkl
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_layer_input = 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
Im having an issue when execute the command of "train.py".I have done every procedure accordingly . The error is given below . Please Help ASAP
python version used : python 2.7
pi@AutoCar:~/autonomous-rc-car-master $ python train.py 0.1 60 Loading images to array... Traceback (most recent call last): File "train.py", line 114, in <module> main() File "train.py", line 107, in main (optimized_theta, function_min_value, info_dict) = minimize_cost_function(initial_theta,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 265, in func_and_grad f = fun(x, *args) File "/usr/lib/python2.7/dist-packages/scipy/optimize/optimize.py", line 281, in function_wrapper return function(*(wrapper_args + args)) File "train.py", line 32, in cost_function_wrapper return cost_function(cost_function_parameters) File "/home/pi/autonomous-rc-car-master/cost_function.py", line 35, in cost_function regularization_term = (lambda_value/(2.0 * input_examples_size)) * numpy.sum(numpy.power(combined_thetas, 2)) ZeroDivisionError: float division by zero
Hi @vaidy @manishrc i am little confused because i see some lines of codes cycle_count...
what is the purpose adding this lines in each directions operations!
kindly 👍
while True:
stream = io.BytesIO()
camera.capture(stream, format='jpeg', use_video_port=True)
direction = predictor.predict(stream)
image_helper.save_image_with_direction(stream, direction)
stream.flush()
if direction == 'forward':
should_brake = True
left_cycle_count = right_cycle_count = 0
forward_cycle_count = reduce_speed(pwm, forward_cycle_count)
motor_driver_helper.set_front_motor_to_idle()
motor_driver_helper.set_forward_mode()
elif direction == 'left':
should_brake = True
forward_cycle_count = right_cycle_count = 0
left_cycle_count = increase_speed_on_turn(pwm, left_cycle_count)
motor_driver_helper.set_left_mode()
motor_driver_helper.set_forward_mode()
elif direction == 'right':
should_brake = True
forward_cycle_count = left_cycle_count = 0
right_cycle_count = increase_speed_on_turn(pwm, right_cycle_count)
motor_driver_helper.set_right_mode()
motor_driver_helper.set_forward_mode()
elif direction == 'reverse':
should_brake = True
motor_driver_helper.set_front_motor_to_idle()
motor_driver_helper.set_reverse_mode()
else:
if should_brake:
print("braking...")
motor_driver_helper.set_reverse_mode()
time.sleep(0.2)
should_brake = False
motor_driver_helper.set_idle_mode()
forward_cycle_count = left_cycle_count = right_cycle_count = 0
motor_driver_helper.change_pwm_duty_cycle(pwm, 100)
print(direction)
I am facing this issue :
Traceback (most recent call last):
File "train.py", line 11, in
from scipy.optimize import fmin_l_bfgs_b
ImportError: No module named 'scipy'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.