JdeRobot / DeepLearningStudio

Collection of Deep Learning algorithms for autonomous control of vehicles on Behavior Metrics Circuits. Contains both PyTorch and Tensorflow implementations.
10 stars 7 forks source link

Problem .json #47

Open jessiffmm opened 2 years ago

jessiffmm commented 2 years ago

There are problems training with the .json. I get the error: File "/home/vanejessi/DeepLearningStudio/Formula1-FollowLine/tensorflow/PilotNet/utils/processing.py", line 19, in parse_json array_annotations_v.append(float(v)) ValueError: could not convert string to float: '"7.0",\n "w": "0.044"\n '

The .json file is: [ { "image_name": "0.png", "v": "7.0", "w": "0.044" }, { "image_name": "1.png", "v": "7.0", "w": "0.022" }, { "image_name": "2.png", "v": "7.0", "w": "0.022" }, { "image_name": "3.png", "v": "7.0", "w": "0.022" }, ... ]

sergiopaniego commented 2 years ago

Are you using the new opencv dataset?

If so, the code is something like this:

def parse_csv(csv_data):
    array = []
    linear_speeds = csv_data['v'].tolist()
    angular_speeds = csv_data['w'].tolist()
    for x, linear_speed in enumerate(linear_speeds):
        array.append((float(linear_speed), float(angular_speeds[x])))
    return array

...

array_annotations = pandas.read_csv(annotation_name_file)
array_annotations = parse_csv(array_annotations)
jessiffmm commented 2 years ago

Yes, I'm using the new opencv dataset. Thanks!!