ahmetozlu / vehicle_counting_tensorflow

:oncoming_automobile: "MORE THAN VEHICLE COUNTING!" This project provides prediction for speed, color and size of the vehicles with TensorFlow Object Counting API.

Home Page:https://www.youtube.com/watch?v=PrqnhHf6fhM

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

IndexError: list index out of range

Margi-016 opened this issue · comments

commented

When I run the code then it gives me the error....

Traceback (most recent call last):

File "", line 1, in
runfile('C:/Users/mark/CarSpeedDetection/vehicle_detection_main.py', wdir='C:/Users/mark/CarSpeedDetection')

File "C:\Users\Administrator\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 705, in runfile
execfile(filename, namespace)

File "C:\Users\Administrator\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)

File "C:/Users/mark/CarSpeedDetection/vehicle_detection_main.py", line 124, in
object_detection_function()

File "C:/Users/mark/CarSpeedDetection/vehicle_detection_main.py", line 91, in object_detection_function
np.squeeze(scores), category_index, use_normalized_coordinates=True, line_thickness=4)

File "C:\Users\mark\CarSpeedDetection\utils\visualization_utils.py", line 304, in visualize_boxes_and_labels_on_image_array
use_normalized_coordinates=use_normalized_coordinates)

File "C:\Users\mark\CarSpeedDetection\utils\visualization_utils.py", line 74, in draw_bounding_box_on_image_array
display_str_list, use_normalized_coordinates)

File "C:\Users\mark\CarSpeedDetection\utils\visualization_utils.py", line 103, in draw_bounding_box_on_image
current_path + "/utils/color_recognition_module/" + "test.data")

File "./utils\color_recognition_module\knn_classifier.py", line 64, in main
neighbors = kNearestNeighbors(training_feature_vector, test_feature_vector[x], k)

File "./utils\color_recognition_module\knn_classifier.py", line 24, in kNearestNeighbors
neighbors.append(distances[x][0])

IndexError: list index out of range

commented

I had similar issues running the code on python 3.5, had to change 'rb' flag to 'r' when it reads the csv data in knn_classifier.py. Also there was one instance where iteritems() was used, if you are using python 3 change it to items().