Skip to content

Instantly share code, notes, and snippets.

Last active September 28, 2020 21:17
What would you like to do?
data = {}
p = r"E:\Documents\My Projects\Instagram Dashboard\Model Development\flower_features.pkl"
# lop through each image in the dataset
for flower in flowers:
# try to extract the features and update the dictionary
feat = extract_features(flower,model)
data[flower] = feat
# if something fails, save the extracted features as a pickle file (optional)
with open(p,'wb') as file:
# get a list of the filenames
filenames = np.array(list(data.keys()))
# get a list of just the features
feat = np.array(list(data.values()))
(210, 1, 4096)
# reshape so that there are 210 samples of 4096 vectors
feat = feat.reshape(-1,4096)
(210, 4096)
# get the unique labels (from the flower_labels.csv)
df = pd.read_csv('flower_labels.csv')
label = df['label'].tolist()
unique_labels = list(set(label))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment