Je lance ce code à partir de tutoriels tensorflow sur mon jupyter avec python3 et j'ai l'erreur suivante;Convolution appliquée sur les images - TypeError: l'objet 'Variable' n'est pas appelable
#Importing
import numpy as np
from scipy import signal
from scipy import misc
import matplotlib.pyplot as plt
from PIL import Image
### Load image of your choice on the notebook
print("Please type the name of your test image after uploading to \
your notebook (just drag and grop for upload. Please remember to \
type the extension of the file. Default: bird.jpg")
raw = input()
im = Image.open(raw) # type here your image's name
# uses the ITU-R 601-2 Luma transform (there are several ways to convert an
# image to grey scale)
image_gr = im.convert("L")
print("\n Original type: %r \n\n" % image_gr)
# convert image to a matrix with values from 0 to 255 (uint8)
arr = np.asarray(image_gr)
print("After conversion to numerical representation: \n\n %r" % arr)
### Activating matplotlib for Ipython
%matplotlib inline
### Plot image
imgplot = plt.imshow(arr)
imgplot.set_cmap('gray')
print("\n Input image converted to gray scale: \n")
plt.show(imgplot)
Please type the name of your test image after uploading to your notebook
(just drag and grop for upload. Please remember to type the extension of the file. Default: bird.jpg
TypeError Traceback (most recent call last)
<ipython-input-26-061778a3dd36> in <module>()
14 print("Please type the name of your test image after uploading to
your notebook (just drag and grop for upload. Please remember to type the
extension of the file. Default: bird.jpg")
15
---> 16 raw = input()
17
18
TypeError: objet 'Variable' est pas appelable
J'ai essayé de rechercher ce TypeError, mais rien spécifié exactement comme objet 'variable'. Appréciez toute votre aide.
L'erreur indique que vous avez déjà une variable appelée 'entrée'. Exécutez-vous ceci dans iPython ou un autre IDE, où il y a une variable appelée 'input'? Essayez de réduire votre script à des parties plus petites pour voir ce qui se casse et ce qui fonctionne. – charlesreid1
Je cours ce code avec le cahier de jupyter. Le raw_input() a été utilisé au début, mais il y avait une erreur de nom indéfini. Puis je l'ai changé en input() comme suggéré pour python3. – Nat