Skip to content

Commit

Permalink
add new feature to the README
Browse files Browse the repository at this point in the history
  • Loading branch information
Cartucho committed May 3, 2018
1 parent d3d0969 commit 4ddfc6e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
7 changes: 7 additions & 0 deletions extra/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@
1) Insert result json files into **predicted/**
2) Run the python script: `python convert_pred_darkflow_json.py`

- ### convert YOLO to our format:

1) Add class list to the file `class_list.txt`
2) Insert predicted objects files into **predicted/**
3) Insert images into **images/**
4) Run the python script: `python convert_pred_yolo.py`

## Remove specific char delimiter from files

E.g. remove `;` from:
Expand Down
8 changes: 3 additions & 5 deletions extra/convert_pred_yolo.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def convert_yolo_coordinates_to_voc(x_c_n, y_c_n, width_n, height_n, img_width,
# create VOC format files
txt_list = glob.glob('*.txt')
if len(txt_list) == 0:
print("Error: no .txt files found in ground-truth")
print("Error: no .txt files found in predicted")
sys.exit()
for tmp_file in txt_list:
#print(tmp_file)
Expand Down Expand Up @@ -75,11 +75,9 @@ def convert_yolo_coordinates_to_voc(x_c_n, y_c_n, width_n, height_n, img_width,
for line in content:
## split a line by spaces.
## "c" stands for center and "n" stands for normalized
## added conf for class confidence from Darknet Yolov2
obj_id, conf, x_c_n, y_c_n, width_n, height_n = line.split()
obj_name = obj_list[int(obj_id)]
left, top, right, bottom = convert_yolo_coordinates_to_voc(x_c_n, y_c_n, width_n, height_n, img_width, img_height)
## add new line to file - print conf, JeallyBeans/kuk
#print(obj_name + " " + str(left) + " " + str(top) + " " + str(right) + " " + str(bottom))
#print(obj_name + " " + str(conf) + " " + str(left) + " " + str(top) + " " + str(right) + " " + str(bottom))
new_f.write(obj_name + " " + str(conf) + " " str(left) + " " + str(top) + " " + str(right) + " " + str(bottom) + '\n')
print("Conversion completed!")
print("Conversion completed!")

0 comments on commit 4ddfc6e

Please sign in to comment.