Reputation: 71
What is the problem here.It gives an error.I don't know what to do.I just copy past the code from a web tutorial.As for the error I can't go ahead.It says name 'datasets' is not defined :
from keras.models import Sequential
from keras.layers import Conv2D
from keras.layers import MaxPooling2D
from keras.layers import Flatten
from keras.layers import Dense
import numpy as np
import matplotlib.patches as mpatches
import matplotlib.pyplot as plt
from tensorflow.examples.tutorials.mnist import input_data
import tensorflow as tf
a = tf.truncated_normal([16,128,128,3])
sess = tf.Session()
sess.run(tf.initialize_all_variables())
sess.run(tf.shape(a))
3
b=tf.reshape(a,[16,49152])
sess.run(tf.shape(b))
classes = ['dogs', 'cats']
num_classes = len(classes)
train_path='C:/Users/ZERO/Desktop/img test/cat vs dog/convnet-image-classifier-master/test/resources/images/training/'
validation_size = 0.2
# batch size
batch_size = 16
data = datasets.read_train_sets(train_path, img_size, classes, validation_size=validation_size)
Upvotes: 1
Views: 19080
Reputation: 1939
import datasets
# Load the dataset
train_dataset = datasets.load_dataset("glue", "mrpc", split="train")
val_dataset = datasets.load_dataset("glue", "mrpc", split="validation")
Upvotes: 0
Reputation: 7676
It depends where you want to get your datasets from. For example, if you want to use scikit-learn
, then put this at the top of your script:
from sklearn import datasets
Upvotes: 1
Reputation: 95
First Do pip install datasets
simply
then secondly import import datasets
. That worked for me.
Upvotes: 0
Reputation: 3633
This is a basic python exception. Python (and everyone reading this question) don't know where to find datasets
. If you are not sure what this error means, you should read up on importing in Python. If you know what it means, you should check whatever tutorial you copied this from. If it is not clear, ask the author of that tutorial.
Upvotes: 1