-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Script: Created empty text file with the same name as the image name
- Loading branch information
Showing
3 changed files
with
29 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
Annotations_yolo/ | ||
Annotations_yolo/ | ||
images/ | ||
labels/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"python.pythonPath": "/home/shovon/anaconda3/bin/python" | ||
"python.pythonPath": "/usr/bin/python3" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#image are in the images folder | ||
#created .txt file will be in the labels folder | ||
import os | ||
|
||
def main(): | ||
dir_path = 'images' | ||
extensions = ['.jpg'] | ||
dir_list = [file for file in os.listdir(dir_path) | ||
if any(file.endswith(ext) for ext in extensions)] | ||
#print(dir_list) | ||
output_dir = 'labels' | ||
if not os.path.exists(output_dir): | ||
os.mkdir(output_dir) | ||
|
||
for image_name in dir_list: | ||
file_name = image_name.split('.')[0] | ||
#print(file_name) | ||
text_file_path = output_dir + "/" + file_name + ".txt" | ||
if not os.path.exists(text_file_path): | ||
f = open(text_file_path, 'w') | ||
f.close() | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |