编译的时候出现了一些问题,记录一下
==========================
经过查阅资料,把alexnet_base.py和customlayer.py里都修改了一下
from keras.layer import merge
就可以了
全部改成merge(代码段里相应的也需要修改)
全部从keras.layer里import,而不是keras.layers.core
============================
首先我是用的是tensorflow作为backend,一开始再jupyter notebook上直接编译的时候
ValueError: You are tring to use the old GPU back-end. It was removed from Theano. Use device=cuda* now. See https://github.com/Theano/Theano/wiki/Converting-to-the-new-gpu-back-end%28gpuarray%29 for more information.
打开code/alexnet_base.py
修改了
os.environ['THEANO_FLAGS'] = "device=cuda×"
然后运行又出现了
/home/chutz/anaconda3/lib/python3.6/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
from ._conv import register_converters as _register_converters
Using TensorFlow backend.
WARNING (theano.tensor.blas): Using NumPy C-API based implementation for BLAS functions.
ERROR (theano.gpuarray): Could not initialize pygpu, support disabled
Traceback (most recent call last):
File "/home/chutz/anaconda3/lib/python3.6/site-packages/theano/gpuarray/__init__.py", line 227, in
use(config.device)
File "/home/chutz/anaconda3/lib/python3.6/site-packages/theano/gpuarray/__init__.py", line 214, in use
init_dev(device, preallocate=preallocate)
File "/home/chutz/anaconda3/lib/python3.6/site-packages/theano/gpuarray/__init__.py", line 99, in init_dev
**args)
File "pygpu/gpuarray.pyx", line 651, in pygpu.gpuarray.init
File "pygpu/gpuarray.pyx", line 569, in pygpu.gpuarray.pygpu_init
ValueError: invalid literal for int() with base 10: '*'
我就注释了import theano as T,如果有知道原因的大神还请不吝赐教
再运行就出现了
ImportError Traceback (most recent call last)in () 4 from keras.optimizers import SGD 5 ----> 6 from alexnet_base import * 7 from utils import * /media/chutz/000FC3F700054C75/AlexNet/AlexNet-Experiments-Keras/Code/alexnet_base.py in () 11 Input, Merge, Lambda 12 from keras.layers.convolutional import Convolution2D, MaxPooling2D, ZeroPadding2D ---> 13 from convnetskeras.customlayers import convolution2Dgroup, crosschannelnormalization, \ 14 splittensor, Softmax4D 15 /media/chutz/000FC3F700054C75/AlexNet/AlexNet-Experiments-Keras/convnets-keras/convnetskeras/customlayers.py in () 1 import numpy as np ----> 2 from keras.layers.core import Lambda, Merge 3 from keras.layers.convolutional import Convolution2D 4 from keras import backend as K 5 ImportError: cannot import name 'Merge'