Comments (12)
Thanks for the update. I fixed the integer division issue with the latest commit.
from interactive-deep-colorization.
I see https://github.com/junyanz/interactive-deep-colorization/blame/python3/ui/gui_draw.py
Strings are already unicode in python3 whereas python2 is old-fashioned ASCII, requiring conversion.
You may want a python3
branch. https://github.com/Benitoite/interactive-deep-colorization/tree/python3
Perhaps a python2/python3 conditional is possible.
I think sometimes people's OS/distribution will allow either one or both pythons, sometimes because of package managers or a dependencies python hook locked to one version.
from interactive-deep-colorization.
It seems that opencv doesn't work on your machine.
You could print the image_file. You can also write a simple test script to test the OpenCV.
import cv2
im_bgr = cv2.imread(your_image_file)
from interactive-deep-colorization.
Test script above with valid image file exits quietly without error.
from interactive-deep-colorization.
hmmm... maybe removing the .encode('utf-8')
. also print out the image_file in the gui_draw.py,
from interactive-deep-colorization.
Ok, removing .encode('utf-8')
I believe the image loads and the program goes to the next step. I guess I have to wait for a long time for the giu to show up? (Yes after a wait the gui has showed up with the mortar and pestle)
test_imgs/mortar_pestle.jpg
scale = 2.000000
from interactive-deep-colorization.
Now that I've got the gui up and running, am now getting this error when clicking on the Load button:
Traceback (most recent call last):
File "/home/bb/ideepcolor/ui/gui_design.py", line 151, in load
self.drawWidget.load_image()
File "/home/bb/ideepcolor/ui/gui_draw.py", line 227, in load_image
img_path = unicode(QFileDialog.getOpenFileName(self, 'load an input image'))
NameError: name 'unicode' is not defined
Removing the unicode() makes it work ok...
from interactive-deep-colorization.
Getting into using the program, I noticed creating a point then assigning a color gives this error. Cannot change to any color, the points always stay gray.
Traceback (most recent call last):
File "/home/bb/ideepcolor/ui/gui_palette.py", line 80, in mousePressEvent
self.update_ui(color_id)
File "/home/bb/ideepcolor/ui/gui_palette.py", line 73, in update_ui
color = self.colors[color_id]
IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices
from interactive-deep-colorization.
Haven't seen that before. Maybe you would like to print out the color_id variable.
from interactive-deep-colorization.
@junyanz When I print the variable at that point in gui_palette.py
it reports 4.0
(when I click on the 4th color in the palette). Choosing colors using the gamut seems to work fine. So self.colors
is expecting to hear something like 4
, but is getting 4.0
obviously not an integer. So when sending to color
, I had to change to
color = self.colors[int(color_id)]
and it works.
So far this is what I've done to get things to work (python3/debian9):
$ git diff
diff --git a/ideepcolor.py b/ideepcolor.py
index 81aff2b..5e6102a 100644
--- a/ideepcolor.py
+++ b/ideepcolor.py
@@ -57,8 +57,7 @@ if __name__ == '__main__':
# initialize application
app = QApplication(sys.argv)
- window = gui_design.GUIDesign(color_model=colorModel, dist_model=distModel,
- img_file=args.image_file, load_size=args.load_size, win_size=args.win_size)
+ window = gui_design.GUIDesign(color_model=colorModel, dist_model=distModel, img_file=args.image_file, load_size=args.load_size, win_size=args.win_size)
app.setStyleSheet(qdarkstyle.load_stylesheet(pyside=False)) # comment this if you do not like dark stylesheet
app.setWindowIcon(QIcon('imgs/logo.png')) # load logo
window.setWindowTitle('iColor')
diff --git a/ui/gui_draw.py b/ui/gui_draw.py
index 6e2abae..7b8dcde 100644
--- a/ui/gui_draw.py
+++ b/ui/gui_draw.py
@@ -51,7 +51,8 @@ class GUIDraw(QWidget):
self.update()
def init_result(self, image_file):
- self.read_image(image_file.encode('utf-8')) # read an image
+ print(image_file)
+ self.read_image(image_file) # read an image
self.reset()
def get_batches(self, img_dir):
@@ -223,7 +224,7 @@ class GUIDraw(QWidget):
self.eraseMode = not self.eraseMode
def load_image(self):
- img_path = unicode(QFileDialog.getOpenFileName(self, 'load an input image'))
+ img_path = QFileDialog.getOpenFileName(self, 'load an input image')
self.init_result(img_path)
def save_result(self):
diff --git a/ui/gui_palette.py b/ui/gui_palette.py
index 9d14030..b7fa908 100644
--- a/ui/gui_palette.py
+++ b/ui/gui_palette.py
@@ -68,9 +68,10 @@ class GUIPalette(QWidget):
def update_ui(self, color_id):
self.color_id = color_id
+ print(color_id)
self.update()
if color_id >= 0:
- color = self.colors[color_id]
+ color = self.colors[int(color_id)]
self.emit(SIGNAL('update_color'), color)
self.update()
Also note now that I've rebuilt caffe
with openmp
things are running faster. 👍
from interactive-deep-colorization.
Awesome, color palettes are working now. Issue remains with Unicode strings. I wonder if that's because python3 strings work different than python2?
from interactive-deep-colorization.
probably. It was introduced by this PR.
from interactive-deep-colorization.
Related Issues (20)
- Local hints render area too small HOT 4
- gpu [GPU_ID]??? Interactive Deep Colorization windows 10 64-bit HOT 12
- OSError Preventing Deepcolor Function? HOT 7
- img_pred = cid.net_forward(input_ab,input_mask) Colab crashes while prediction in Global Demo file HOT 2
- SystemError: <Boost.Python.function object at 0x17369c0> returned NULL without setting an error HOT 1
- Trouble installing PyQt4 on windows 10 using Anaconda HOT 1
- Retain the Original Colors
- Windows 7 GUI not starting HOT 2
- RuntimeError: Error(s) in loading state_dict for SIGGRAPHGenerator
- Wrong color value in put_point function
- Just a note if pip install pytorch torchvision doesn't work
- error: "name 'unicode' is not defined" HOT 1
- On Windows 10 with pytorch, it will only use the CPU despite saying it's using the GPU HOT 1
- Failed to load module "appmenu-gtk-module" HOT 1
- What is a,b value for black color. HOT 3
- The QT5 version expects qt4 libraries. it is impossible for a lay person like me to get QT4 on Modern Linux distros HOT 2
- can you make it even harder to setup enviroment ? HOT 1
- Question about training and demo
- Question about the paper
- Model URL no longer working HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from interactive-deep-colorization.