mirror of
https://github.com/azaion/ai-training.git
synced 2026-04-22 08:36:34 +00:00
add dataset-visualiser.py
This commit is contained in:
+10
-4
@@ -163,11 +163,17 @@ def fix_class(folder):
|
||||
if label.startswith('0000'):
|
||||
with open(os.path.join(folder, label), 'r+') as f:
|
||||
lines = f.readlines()
|
||||
truncated = False
|
||||
for i in range(0, len(lines)):
|
||||
l = lines[i]
|
||||
lines[i] = f'2{l[1:]}'
|
||||
f.seek(0) # rewind
|
||||
f.writelines(lines)
|
||||
if len(lines[i]) < 25:
|
||||
print(lines[i])
|
||||
truncated = True
|
||||
lines.pop(i)
|
||||
if truncated:
|
||||
f.truncate(0)
|
||||
f.seek(0)
|
||||
f.writelines(lines)
|
||||
f.close()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
Reference in New Issue
Block a user