赞
踩
Asked 1 year, 6 months ago
Active 3 months ago
Viewed 38k times
68
I have started learning Tensorflow. I am using Pycharm and my environment is Ubuntu 16.04. I am following the tutorial. I cross check the nump. It is up-to-date. I don't know the reason of this error.
from numpy.lib.arraypad import _validate_lengths
ImportError: cannot import name '_validate_lengths'
Need hint to resolve this error. Thank you.
- import tensorflow as tf
- from skimage import transform
- from skimage import data
- import matplotlib.pyplot as plt
- import os
- import numpy as np
- from skimage.color import rgb2gray
- import random
-
- #listdir: This method returns a list containing the names of the entries in the directory given by path.
- # Return True if path is an existing directory
-
- def load_data(data_dir):
- # Get all subdirectories of data_dir. Each represents a label.
- directories = [d for d in os.listdir(data_dir)
- if os.path.isdir(os.path.join(data_dir, d))]
- # Loop through the label directories and collect the data in
- # two lists, labels and images.
- labels = []
- images = []
- for d in directories:
- label_dir = os.path.join(data_dir, d)
- file_names = [os.path.join(label_dir, f)
- for f in os.listdir(label_dir)
- if f.endswith(".ppm")]
- for f in file_names:
- images.append(data.imread(f))
- labels.append(int(d))
- return images, labels
-
-
- ROOT_PATH = "/home/tahir/PhD Study/Traffic Signs Using Tensorflow/"
- train_data_dir = os.path.join(ROOT_PATH, "TrafficSigns/Training
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。