6 Matching Annotations
  1. Last 7 days
    1. vectors here have length 7 instead of 6 because of the extra 0 element at the beginning. This is an inconsequential detail - Keras reserves index 0 and never assigns it to any word.

      Keras always reserves 0 and never assigns any word to it; therefore, even when we have 6 words, we end up with the length of 7:

      [0. 1. 1. 1. 0. 0. 0.]

    2. Here’s my preferred way of doing it, which uses Keras’s Tokenizer class

      Keras's Tokenizer Class - Victor's preferred way of implementing BOW in Python

  2. Sep 2018
    1. 注意 keras 处理 CNN 的形状

      在 keras 中 fit 给 CNN 的数据集的形状必须是:

      theano: (-1, channel, height, width)

      tensorflow: (-1, height, width, channel)

      如果不是必须reshape到这个形状,第一层卷积层的声明一般为:

      model.add( Conv2D(kernelNum, (kernelHeight, kernelWidth), input_shape=(dataPointChannel, dataPointHeight, dataPointWidth), data_format='channels_first'))

      切记,切记

    1. from vis.modifiers import Jitter

      Here the code is obsoleted, should change to:

      from vis.input_modifiers import Jitter

    2. from vis.utils.vggnet import VGG16

      Here the vis.utils.vggnet is deleted, should change with keras original package:

      from keras.applications.vgg16 import VGG16

    1. @mingrutar - Correction: config = tf.ConfigProto() config.gpu_options.allow_growth = True session = tf.Session(config=config)

      当运行 keras 进行模型训练时,如果遇到以下错误:

      failed to create cublas handle: CUBLAS_STATUS_ALLOC_FAILED

      可以添加这样的语句,如此之后可以正常运行了。