Tflearn bad magic number 错误?
Tflearn bad magic number error?
我在使用 tflearn 时遇到此错误:
Traceback (most recent call last):
File "aaa.py", line 1, in <module>
import tflearn
ImportError: bad magic number in 'tflearn': b'\x03\xf3\r\n'
我找到了一种解决方案,即卸载并重新安装。
但是,它没有用。
这是我试过的代码:
import tflearn
from tflearn.layers.conv import conv_2d, max_pool_2d
from tflearn.layers.core import input_data, dropout, fully_connected
from tflearn.layers.estimator import regression
import tflearn.datasets.mnist as mnist
X, Y, test_x, test_y = mnist.load_data(one_hot=True)
X = X.reshape([-1, 28, 28, 1])
test_x = test_x.reshape([-1, 28, 28, 1])
# Building convolutional convnet
convnet = input_data(shape=[None, 28, 28, 1], name='input')
# http://tflearn.org/layers/conv/
# http://tflearn.org/activations/
convnet = conv_2d(convnet, 32, 2, activation='relu')
convnet = max_pool_2d(convnet, 2)
convnet = conv_2d(convnet, 64, 2, activation='relu')
convnet = max_pool_2d(convnet, 2)
convnet = fully_connected(convnet, 1024, activation='relu')
convnet = dropout(convnet, 0.8)
convnet = fully_connected(convnet, 10, activation='softmax')
convnet = regression(convnet, optimizer='adam', learning_rate=0.01, loss='categorical_crossentropy', name='targets')
model = tflearn.DNN(convnet)
model.load('quicktest.model')
拜托,帮忙。
删除 .pyc 文件,有效。
find . -name '*.pyc' -delete
in the tflearn install directory as
suggested in whosebug.com/a/514395/7738328`
我在使用 tflearn 时遇到此错误:
Traceback (most recent call last):
File "aaa.py", line 1, in <module>
import tflearn
ImportError: bad magic number in 'tflearn': b'\x03\xf3\r\n'
我找到了一种解决方案,即卸载并重新安装。
但是,它没有用。
这是我试过的代码:
import tflearn
from tflearn.layers.conv import conv_2d, max_pool_2d
from tflearn.layers.core import input_data, dropout, fully_connected
from tflearn.layers.estimator import regression
import tflearn.datasets.mnist as mnist
X, Y, test_x, test_y = mnist.load_data(one_hot=True)
X = X.reshape([-1, 28, 28, 1])
test_x = test_x.reshape([-1, 28, 28, 1])
# Building convolutional convnet
convnet = input_data(shape=[None, 28, 28, 1], name='input')
# http://tflearn.org/layers/conv/
# http://tflearn.org/activations/
convnet = conv_2d(convnet, 32, 2, activation='relu')
convnet = max_pool_2d(convnet, 2)
convnet = conv_2d(convnet, 64, 2, activation='relu')
convnet = max_pool_2d(convnet, 2)
convnet = fully_connected(convnet, 1024, activation='relu')
convnet = dropout(convnet, 0.8)
convnet = fully_connected(convnet, 10, activation='softmax')
convnet = regression(convnet, optimizer='adam', learning_rate=0.01, loss='categorical_crossentropy', name='targets')
model = tflearn.DNN(convnet)
model.load('quicktest.model')
拜托,帮忙。
删除 .pyc 文件,有效。
find . -name '*.pyc' -delete
in the tflearn install directory as suggested in whosebug.com/a/514395/7738328`