You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am not familiar to python, however this approach seems to be great for the type augmentations I need.
Since it is necessary to use pickle format, how can I change my txt file, which order is classes x1 x2 y1 y2
to pickle format, which order needs to be the following? x1 y1 x2 y2 classes
The text was updated successfully, but these errors were encountered:
in_coor = ['class','x1','y1','x2','y2'] # how in your file was sorted.
out_coor = ['x1','y1','x2','y2','class'] # how it was requested by algorithm.
filetxt = 'yourfile.txt' # path of your file txt
with open(filetxt) as f:
contents = f.readlines()
data = list()
for i in contents:
data.append([float(j) for j in i.split(',')])
data_arr = np.asarray(data)
in_order = {j:i for i,j in enumerate(in_coor)}
sort_in = [in_order[k] for k in in_coor]
sort_out = [in_order[k] for k in out_coor]
bboxes = data_arr[:,sort_out]
#inspect the bounding boxes
print(bboxes)
I am not familiar to python, however this approach seems to be great for the type augmentations I need.
Since it is necessary to use pickle format, how can I change my txt file, which order is
classes x1 x2 y1 y2
to pickle format, which order needs to be the following?
x1 y1 x2 y2 classes
The text was updated successfully, but these errors were encountered: