Dieser Artikel ist der dritte Tagesartikel von Python Advent Calendar 2016. Es ist eine besiegte Geschichte, daher endet das Ende mit einem Fehler.
Eine Bibliothek, die DeepLearning verwendet, um Bilder für 3D zu konvertieren.
--Erstellen Sie eine AWS g2.2xlarge- oder g2.8xlarge EC2-Instanz
--CUDA (GPU integrierte Entwicklungsumgebung) --cuDNN (Bibliothek zum Ausführen eines neuronalen Netzwerks auf einer GPU)
――Ist es gut, sich darauf zu beziehen? - deep3d.ipynb
import mxnet as mx
import numpy as np
import os
import urllib
import cv2
from PIL import Image
from images2gif import writeGif
import logging
logging.basicConfig(level=logging.DEBUG)
if not os.path.exists('deep3d-0050.params'):
urllib.urlretrieve('http://homes.cs.washington.edu/~jxie/download/deep3d-0050.params', 'deep3d-0050.params')
model = mx.model.FeedForward.load('deep3d', 50, mx.gpu(0))
shape = (384, 160)
img = cv2.imread('demo.jpg')
raw_shape = (img.shape[1], img.shape[0])
img = cv2.resize(img, shape)
X = img.astype(np.float32).transpose((2,0,1))
X = X.reshape((1,)+X.shape)
test_iter = mx.io.NDArrayIter({'left': X, 'left0':X})
Y = model.predict(test_iter)
FATAL ERROR!!!!
>>> test_iter = mx.io.NDArrayIter({'left': X, 'left0':X})
>>> Y = model.predict(test_iter)
[16:21:56] src/operator/./reshape-inl.h:311: Using target_shape will be deprecated.
[16:21:57] src/operator/./reshape-inl.h:311: Using target_shape will be deprecated.
[16:21:57] src/operator/./reshape-inl.h:311: Using target_shape will be deprecated.
[16:21:57] /home/ubuntu/mxnet/dmlc-core/include/dmlc/logging.h:235: [16:21:57] src/operator/./cudnn_softmax_activation-inl.h:44: Check failed: (in_data[softmax_activation::kData].ndim()) == (2) Input need to have 2 dimensions when mode=instance.
[16:21:57] /home/ubuntu/mxnet/dmlc-core/include/dmlc/logging.h:235: [16:21:57] src/engine/./threaded_engine.h:306: [16:21:57] src/operator/./cudnn_softmax_activation-inl.h:44: Check failed: (in_data[softmax_activation::kData].ndim()) == (2) Input need to have 2 dimensions when mode=instance.
An fatal error occurred in asynchronous engine operation. If you do not know what caused this error, you can try set environment variable MXNET_ENGINE_TYPE to NaiveEngine and run with debugger (i.e. gdb). This will force all operations to be synchronous and backtrace will give you the series of calls that lead to this error. Remember to set MXNET_ENGINE_TYPE back to empty after debugging.
terminate called after throwing an instance of 'dmlc::Error'
what(): [16:21:57] src/engine/./threaded_engine.h:306: [16:21:57] src/operator/./cudnn_softmax_activation-inl.h:44: Check failed: (in_data[softmax_activation::kData].ndim()) == (2) Input need to have 2 dimensions when mode=instance.
An fatal error occurred in asynchronous engine operation. If you do not know what caused this error, you can try set environment variable MXNET_ENGINE_TYPE to NaiveEngine and run with debugger (i.e. gdb). This will force all operations to be synchronous and backtrace will give you the series of calls that lead to this error. Remember to set MXNET_ENGINE_TYPE back to empty after debugging.
Aborted (core dumped)
why?
Input need to have 2 dimensions when mode=instance.
Ȇbergeben Sie es?
test_iter = mx.io.NDArrayIter({'left': X, 'left0':X})
――Ich habe den Quellcode von c ++ gelesen, konnte ihn aber nicht lösen ...――Es scheint, dass deep3d auch für Videos verwendet werden kann, also möchte ich mein Bestes geben ――Ich möchte die Logik von DeepLearning verstehen. --AWS ist sehr praktisch
Recommended Posts