Coder Social home page Coder Social logo

Comments (12)

junyanz avatar junyanz commented on August 25, 2024 1

Thanks for the update. I fixed the integer division issue with the latest commit.

from interactive-deep-colorization.

Benitoite avatar Benitoite commented on August 25, 2024 1

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.

junyanz avatar junyanz commented on August 25, 2024

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.

Benitoite avatar Benitoite commented on August 25, 2024

Test script above with valid image file exits quietly without error.

from interactive-deep-colorization.

junyanz avatar junyanz commented on August 25, 2024

hmmm... maybe removing the .encode('utf-8'). also print out the image_file in the gui_draw.py,

from interactive-deep-colorization.

Benitoite avatar Benitoite commented on August 25, 2024

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.

Benitoite avatar Benitoite commented on August 25, 2024

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.

Benitoite avatar Benitoite commented on August 25, 2024

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.

junyanz avatar junyanz commented on August 25, 2024

Haven't seen that before. Maybe you would like to print out the color_id variable.

from interactive-deep-colorization.

Benitoite avatar Benitoite commented on August 25, 2024

@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.

Benitoite avatar Benitoite commented on August 25, 2024

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.

junyanz avatar junyanz commented on August 25, 2024

probably. It was introduced by this PR.

from interactive-deep-colorization.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.