のねのBlog

パソコンの問題や、ソフトウェアの開発で起きた問題など書いていきます。よろしくお願いします^^。

jupyter notebookを開くと、白いBlankの画面になる。開かない。

  • Chromeで、シークレットモードで開いたら、開けた。
  • edgeでは、普通に開けた。

text/plainが影響しているらしい。

Chromeで、 CTRL+Shift+Rを白いBlankの画面で行ったら、 正常に開けるようになった。

Refused to execute script from '<URL>' because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled.
VM25 tree:1 Refused to execute script from
    'http://localhost:8889/static/components/es6-promise/promise.min.js?v=f004a16cb856e0ff11781d01ec5ca8fe' 
    because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled.
VM25 tree:1 Refused to execute script from
    'http://localhost:8889/static/components/preact/index.js?v=00a2fac73c670ce39ac53d26640eb542' 
    because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled.
VM25 tree:1 Refused to execute script from 
    'http://localhost:8889/static/components/proptypes/index.js?v=c40890eb04df9811fcc4d47e53a29604' 
    because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled.
VM25 tree:1 Refused to execute script from 
    'http://localhost:8889/static/components/preact-compat/index.js?v=aea8f6660e54b18ace8d84a9b9654c1c' 
    because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled.
VM25 tree:1 Refused to execute script from 
    'http://localhost:8889/static/components/requirejs/require.js?v=951f856e81496aaeec2e71a1c2c0d51f' 
    because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled.

VM25 tree:24 Uncaught ReferenceError: require is not defined
    at VM25 tree:24

namespace.js:29 Uncaught ReferenceError: define is not defined
    at namespace.js:29
tree:1 Unchecked runtime.lastError: The message port closed before a response was received.

When opening a notebook file, the browser displays a blank screen · Issue #1627 · jupyter/notebook · GitHub

stackoverflow.com

stackoverflow.com

keras vgg19 64x64と128x128と224x224のときの違い

from keras.preprocessing import image
import keras.applications.vgg19 as vgg19

model = vgg19.VGG19(weights=None, input_shape=(64, 64, 3))
model.summary()
_________________________________________________________________
Layer (type)                 Output Shape              Param #   
=================================================================
input_3 (InputLayer)         (None, 64, 64, 3)         0         
_________________________________________________________________
block1_conv1 (Conv2D)        (None, 64, 64, 64)        1792      
_________________________________________________________________
block1_conv2 (Conv2D)        (None, 64, 64, 64)        36928     
_________________________________________________________________
block1_pool (MaxPooling2D)   (None, 32, 32, 64)        0         
_________________________________________________________________
block2_conv1 (Conv2D)        (None, 32, 32, 128)       73856     
_________________________________________________________________
block2_conv2 (Conv2D)        (None, 32, 32, 128)       147584    
_________________________________________________________________
block2_pool (MaxPooling2D)   (None, 16, 16, 128)       0         
_________________________________________________________________
block3_conv1 (Conv2D)        (None, 16, 16, 256)       295168    
_________________________________________________________________
block3_conv2 (Conv2D)        (None, 16, 16, 256)       590080    
_________________________________________________________________
block3_conv3 (Conv2D)        (None, 16, 16, 256)       590080    
_________________________________________________________________
block3_conv4 (Conv2D)        (None, 16, 16, 256)       590080    
_________________________________________________________________
block3_pool (MaxPooling2D)   (None, 8, 8, 256)         0         
_________________________________________________________________
block4_conv1 (Conv2D)        (None, 8, 8, 512)         1180160   
_________________________________________________________________
block4_conv2 (Conv2D)        (None, 8, 8, 512)         2359808   
_________________________________________________________________
block4_conv3 (Conv2D)        (None, 8, 8, 512)         2359808   
_________________________________________________________________
block4_conv4 (Conv2D)        (None, 8, 8, 512)         2359808   
_________________________________________________________________
block4_pool (MaxPooling2D)   (None, 4, 4, 512)         0         
_________________________________________________________________
block5_conv1 (Conv2D)        (None, 4, 4, 512)         2359808   
_________________________________________________________________
block5_conv2 (Conv2D)        (None, 4, 4, 512)         2359808   
_________________________________________________________________
block5_conv3 (Conv2D)        (None, 4, 4, 512)         2359808   
_________________________________________________________________
block5_conv4 (Conv2D)        (None, 4, 4, 512)         2359808   
_________________________________________________________________
block5_pool (MaxPooling2D)   (None, 2, 2, 512)         0         
_________________________________________________________________
flatten (Flatten)            (None, 2048)              0         
_________________________________________________________________
fc1 (Dense)                  (None, 4096)              8392704   
_________________________________________________________________
fc2 (Dense)                  (None, 4096)              16781312  
_________________________________________________________________
predictions (Dense)          (None, 1000)              4097000   
=================================================================
Total params: 49,295,400
Trainable params: 49,295,400
Non-trainable params: 0
_________________________________________________________________

f:id:none53:20190416134227p:plain

20190416_vgg19_models.ipynb

ValueError: When setting `include_top=True` and loading `imagenet` weights, `input_shape` should be (224, 224, 3).

from keras.preprocessing import image
import keras.applications.vgg19 as vgg19

model = vgg19.VGG19(weights='imagenet', input_shape=(64, 64, 3))
model.summary()
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-6-7f2e82711ae3> in <module>()
      2 import keras.applications.vgg19 as vgg19
      3 
----> 4 model = vgg19.VGG19(weights='imagenet', input_shape=(64, 64, 3))
      5 model.summary()

/usr/local/lib/python3.6/dist-packages/keras/applications/__init__.py in wrapper(*args, **kwargs)
     26             kwargs['models'] = models
     27             kwargs['utils'] = utils
---> 28         return base_fun(*args, **kwargs)
     29 
     30     return wrapper

/usr/local/lib/python3.6/dist-packages/keras/applications/vgg19.py in VGG19(*args, **kwargs)
      9 @keras_modules_injection
     10 def VGG19(*args, **kwargs):
---> 11     return vgg19.VGG19(*args, **kwargs)
     12 
     13 

/usr/local/lib/python3.6/dist-packages/keras_applications/vgg19.py in VGG19(include_top, weights, input_tensor, input_shape, pooling, classes, **kwargs)
     97                                       data_format=backend.image_data_format(),
     98                                       require_flatten=include_top,
---> 99                                       weights=weights)
    100 
    101     if input_tensor is None:

/usr/local/lib/python3.6/dist-packages/keras_applications/imagenet_utils.py in _obtain_input_shape(input_shape, default_size, min_size, data_format, require_flatten, weights)
    290                                  'and loading `imagenet` weights, '
    291                                  '`input_shape` should be ' +
--> 292                                  str(default_shape) + '.')
    293         return default_shape
    294     if input_shape:

ValueError: When setting `include_top=True` and loading `imagenet` weights, `input_shape` should be (224, 224, 3).

imagenetのウェイトを使うとき、input_shapeはデフォルトのみ

    if weights == 'imagenet' and require_flatten:
        if input_shape is not None:
            if input_shape != default_shape: <==================ここで、エラーになる
                raise ValueError('When setting `include_top=True` '
                                 'and loading `imagenet` weights, '
                                 '`input_shape` should be ' +
                                 str(default_shape) + '.') 
        return default_shape
    if input_shape:
        if data_format == 'channels_first':
            if input_shape is not None:
                if len(input_shape) != 3:
                    raise ValueError(
                        '`input_shape` must be a tuple of three integers.')
                if input_shape[0] != 3 and weights == 'imagenet':
                    raise ValueError('The input must have 3 channels; got '
                                     '`input_shape=' + str(input_shape) + '`')
                if ((input_shape[1] is not None and input_shape[1] < min_size) or
                   (input_shape[2] is not None and input_shape[2] < min_size)):
                    raise ValueError('Input size must be at least ' +
                                     str(min_size) + 'x' + str(min_size) +
                                     '; got `input_shape=' +
                                     str(input_shape) + '`')

keras-applications/imagenet_utils.py at master · keras-team/keras-applications · GitHub