Last active
July 4, 2018 08:51
-
-
Save oem/322dae2ed45a34fcc84ce324b84df7ed to your computer and use it in GitHub Desktop.
labelling the beer dataset for our beer-o-mat app
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 turicreate as tc | |
import re | |
import os | |
def path_as_label(path): | |
label = re.search('(?<=raw/)(.+)?/.+$', path).group(1) | |
label = label.replace('_', ' ') | |
return label.title() | |
img_path = os.path.join(os.path.dirname(__file__), 'data/raw') | |
data = tc.image_analysis.load_images(img_path, with_path=True) | |
data['label'] = data['path'].apply(path_as_label) | |
data.save(os.path.join(os.path.dirname(__file__), | |
'data/processed/beers.sframe')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment