lmoroney / dlaicourse

Notebooks for learning deep learning
5.66k stars 5.36k forks source link

TFLite_Week2_Exercise #64

Open chunyeow opened 4 years ago

chunyeow commented 4 years ago

I am facing the following issue whenever running the exercise on Tensorflow deployment:

splits = tfds.Split.ALL.subsplit(weighted=(80, 10, 10))

splits, info = tfds.load('rock_paper_scissors', with_info=True, as_supervised=True, split = splits)

(train_examples, validation_examples, test_examples) = splits

num_examples = info.splits['train'].num_examples
num_classes = info.features['label'].num_classes

AssertionError: Unrecognized instruction format: NamedSplitAll()(tfds.percent[0:80])

Anyone know what's the problem?

AndresR2909 commented 4 years ago

Hello, first I upgraded tensorflow and then replaced the code as showed below:

`# To determine which version you're using: !pip show tensorflow

For the current version:

!pip install --upgrade tensorflow

For the latest nightly build:

!pip install tf-nightly`

deleting code:

splits = tfds.Split.ALL.subsplit(weighted=(80, 10, 10))

splits, info = tfds.load('horses_or_humans', with_info=True, as_supervised=True, split = splits)

(train_examples, validation_examples, test_examples) = splits

new code: `(train_examples, validation_examples, test_examples), info = tfds.load('horses_or_humans',split=['train[80%:]', 'train[80%:90%]', 'train[90%:]'],with_info=True,as_supervised=True)

num_examples = info.splits['train'].num_examples num_classes = info.features['label'].num_classes`