Closed sangtuaco closed 4 years ago
This sounds like the module is unable to reach pytorch. Can you open python separately on the same environment you plan to use and run import torch to see if that will be successful?
@mabdelhack , you are exactly right. For some reason, the import
of torch does not appear to work.
~Do you know why this might be? Unfortunately, torch cannot be imported either. ~~
First, I tried running import torch
and received the same [Win126] error:
_import torch
Traceback (most recent call last):
File "
Then, I ran import pytorch just to doublecheck, which also did not work.
>>> import pytorch
Traceback (most recent call last):
File "
Interestingly, I installed pytorch (and thus torchvision) via the official website (which generated the conda install command). This is also the only module I installed via conda
, not pip
. ~~
Dear @mabdelhack,
I fixed the problem by downloading a CPU-only version of PyTorch that was compatible with my computer. However, I continue to be unable to open the program due to another system error:
SystemError: <built-in function imread> returned NULL without setting an error
What I have done:
python ideepcolor.py --gpu 0 --backend pytorch --cpu_mode
I received:
[win_size] = 512 [image_file] = test_imgs/mortar_pestle.jpg [gpu] = 0 [cpu_mode] = True [color_prototxt] = ./models/reference_model/deploy_nodist.prototxt [color_caffemodel] = ./models/reference_model/model.caffemodel [dist_prototxt] = ./models/reference_model/deploy_nopred.prototxt [dist_caffemodel] = ./models/reference_model/model.caffemodel [color_model] = ./models/pytorch/caffemodel.pth [backend] = pytorch [pytorch_maskcent] = False [load_size] = 256 ColorizeImageTorch instantiated path = ./models/pytorch/caffemodel.pth Model set! dist mode? False ColorizeImageTorch instantiated path = ./models/pytorch/caffemodel.pth Model set! dist mode? True b'test_imgs/mortar_pestle.jpg' Traceback (most recent call last): File "ideepcolor.py", line 79, in
img_file=args.image_file, load_size=args.load_size, win_size=args.win_size) File "C:\Users\StevenJobs\Documents\2 - WashU Sophomore\2 - WashU Sophomore SP20\CSE204 Code Repository\cse204\interactive-deep-colorization\ui\gui_design.py", line 112, in init self.drawWidget.init_result(img_file) File "C:\Users\StevenJobs\Documents\2 - WashU Sophomore\2 - WashU Sophomore SP20\CSE204 Code Repository\cse204\interactive-deep-colorization\ui\gui_draw.py", line 48, in init_result self.read_image(image_file.encode('utf-8')) # read an image File "C:\Users\StevenJobs\Documents\2 - WashU Sophomore\2 - WashU Sophomore SP20\CSE204 Code Repository\cse204\interactive-deep-colorization\ui\gui_draw.py", line 73, in read_image im_bgr = cv2.imread(image_file) SystemError: returned NULL without setting an error
This means you probably downloaded the default branch rather than the windows branch because I had the same problem and fixed the code accordingly. You should switch to the windows branch and then download the repo.
@sangtuaco,
Try (gui_draw.py", line 48) self.read_image(image_file) instead of self.read_image(image_file.encode('utf-8'))
It fixed the issue for me, however GUI never starts now and doesn't report any errors. I've tried GPU and CPU modes.
Please let me know if it works for you!
Dear @mabdelhack and @elmeto7,
I made the changes you recommended, and the program now works as intended. Thank you kindly for all of your assistance; the Father's Day gift went smashingly.
Thanks, sangtuaco
@elmeto7 I remember I fixed more than this line for the windows version to work so try downloading that branch.
Dear Devs,
Thank you for providing this unique demo program! Based on the video, I am attempting to use your code to 'restore' old family images in preparation for Father's Day. However, as a novice coder, I have been running into a lot of brick walls. After seemingly beating dependency hell using the
pip
installation instructions from @mabdelhack, I have run intoOSError: [WinError 126] The specified module could not be found
, which I have not been able to solve.Can I ask any help beating this OSError? The command I am running is
colorModel.prep_net(path=args.color_model)
File "C:\Users\StevenJobs\Documents\2 - WashU Sophomore\2 - WashU Sophomore SP20\CSE204 Code Repository\cse204\interactive-deep-colorization\data\colorize_image.py", line 217, in prep_net
import torch
File "C:\Users\StevenJobs\miniconda3\envs\finaldeep\lib\site-packages\torch__init.py", line 81, in
ctypes.CDLL(dll)
File "C:\Users\StevenJobs\miniconda3\envs\finaldeep\lib\ctypes\ init.py", line 364, in init__
self._handle = _dlopen(self.name, mode)
OSError: [WinError 126] The specified module could not be found
python ideepcolor.py --gpu 0 --backend pytorch
, which results in the following error message: _[win_size] = 512 [image_file] = test_imgs/mortar_pestle.jpg [gpu] = 0 [cpu_mode] = True [color_prototxt] = ./models/reference_model/deploy_nodist.prototxt [color_caffemodel] = ./models/reference_model/model.caffemodel [dist_prototxt] = ./models/reference_model/deploy_nopred.prototxt [dist_caffemodel] = ./models/reference_model/model.caffemodel [color_model] = ./models/pytorch/caffemodel.pth [backend] = pytorch [pytorch_maskcent] = False [load_size] = 256 ColorizeImageTorch instantiated Traceback (most recent call last): File "ideepcolor.py", line 69, inI am on a Windows 10 operating system, and my virtual environment is as follows: #
Dependencies:
blas 1.0 mkl ca-certificates 2020.1.1 0 certifi 2020.4.5.2 py37_0 cudatoolkit 10.2.89 h74a9793_1 cycler 0.10.0 pypi_0 pypi decorator 4.4.2 pypi_0 pypi freetype 2.9.1 ha9979f8_1 helpdev 0.7.1 pypi_0 pypi icc_rt 2019.0.0 h0cc432a_1 imageio 2.8.0 pypi_0 pypi importlib-metadata 1.6.1 pypi_0 pypi intel-openmp 2020.1 216 joblib 0.15.1 pypi_0 pypi jpeg 9b hb83a4c4_2 kiwisolver 1.2.0 pypi_0 pypi libpng 1.6.37 h2a8f88b_0 libtiff 4.1.0 h56a325e_1 lz4-c 1.9.2 h62dcd97_0 matplotlib 3.2.1 pypi_0 pypi mkl 2020.1 216 mkl-service 2.3.0 py37hb782905_0 mkl_fft 1.0.15 py37h14836fe_0 mkl_random 1.1.1 py37h47e9c7a_0 networkx 2.4 pypi_0 pypi ninja 1.9.0 py37h74a9793_0 numpy 1.18.1 py37h93ca92e_0 numpy-base 1.18.1 py37hc3f5095_1 olefile 0.46 py37_0 opencv-python 4.2.0.34 pypi_0 pypi openssl 1.1.1g he774522_0 pillow 7.1.2 py37hcc1f983_0 pip 20.1.1 py37_1 pyparsing 2.4.7 pypi_0 pypi pyqt4 4.11.4 pypi_0 pypi python 3.7.7 h81c818b_4 python-dateutil 2.8.1 pypi_0 pypi pytorch 1.5.0 py3.7_cuda102_cudnn7_0 pytorch pywavelets 1.1.1 pypi_0 pypi qdarkstyle 2.8.1 pypi_0 pypi qtpy 1.9.0 pypi_0 pypi scikit-image 0.17.2 pypi_0 pypi scikit-learn 0.23.1 pypi_0 pypi scipy 1.4.1 pypi_0 pypi setuptools 47.3.0 py37_0 six 1.15.0 py_0 sqlite 3.31.1 h2a8f88b_1 threadpoolctl 2.1.0 pypi_0 pypi tifffile 2020.6.3 pypi_0 pypi tk 8.6.8 hfa6e2cd_0 torchvision 0.6.0 py37_cu102 pytorch vc 14.1 h0510ff6_4 vs2015_runtime 14.16.27012 hf0eaf9b_2 wheel 0.34.2 py37_0 wincertstore 0.2 py37_0 xz 5.2.5 h62dcd97_0 zipp 3.1.0 pypi_0 pypi zlib 1.2.11 h62dcd97_4 zstd 1.4.4 ha9fde0e_3`