This file contains hidden or 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
| def top_5_preds(preds): return np.argsort(preds.numpy())[:, ::-1][:, :5] | |
| def top_5_pred_labels(preds, classes): | |
| top_5 = top_5_preds(preds) | |
| labels = [] | |
| for i in range(top_5.shape[0]): | |
| labels.append(' '.join([classes[idx] for idx in top_5[i]])) | |
| return labels |
This file contains hidden or 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
| import zipfile as zf | |
| files = zf.ZipFile("archive_name.zip", 'r') | |
| files.extractall('./extrac_to_path') | |
| files.close() |
This file contains hidden or 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
| import shutil | |
| import os | |
| path = "E:/folder_name/" | |
| files = os.listdir(path) | |
| for key in range(0, len(files)): | |
| shutil.move(path + files[key], path + str(key) + ".jpeg") |