Visual GUI

(Amrit ) #1

I worked on a GUI that I wanted to share. The aim was to provide an easy to use graphical interface without the need to dig deep into the code, and provide all aspects of choosing and viewing parameters and outputs within 1 line of sight. This easy to implement GUI provides a good starting point to get training quickly using fastai.

Here is the link to a quick video showing its use (updated to include results tab): https://www.youtube.com/watch?v=I6hTbjUQvPU

The code can be found on my github: https://github.com/asvcode/Vision_UI

I am working on further developments/additions and would love to here any suggestions/thoughts/advice.

Thanks

36 Likes

Visualizing the Confusion Matrix
Fastai graphical user interface for Google Colab
Share you work here - highlights
How to create IPython Widgets?
Applying transformations to images in a folder and save them as a new folder
(Stefano Giomo) #2

That’s awesome!

1 Like

(Zach) #3

brilliant work!

1 Like

(Fabrizio) #4

For inspiration, take a look at this

5 Likes

(Jochem) #5

Wow, congrats! That looks great. Grad student descent just got a whole lot easier ;).

1 Like

(Amrit ) #6

A couple of additions made to the visual_UI. A results tab was added so that a trained model can be loaded and view the results by plotting top losses or confusion matrix (this is still a work in progress), hoping to get better functionality so that it is super easy to use fastai via a GUI.

2 Likes

#7

Hi Amrit, your visual UI project is super cool! At the moment, I’m able to launch it successfully, but every time Python3 launches a new window, for example, to select a folder, it freezes the machine, and I need to Force Quit. Have you encountered anything like this? Could it be an issue with my browser (Firefox)? Do you have any suggestions on what may be the issue? Thanks @amritv ! Looking forward to experimenting with it!

0 Likes

(Amrit ) #8

Hey @Nat, glad you like it! I just tested it with Firefox (although I have only used Chrome previously) and was able to run with no issues.

I have updated the code to make it better however, try this code on its own to chose a folder to see if you still have an issue:

from tkinter import Tk
from tkinter.filedialog import askdirectory

def folder_choice():
root = Tk()
folder_choice.path = askdirectory(title=‘Select Folder’)
root.destroy()
print(‘Data folder:’, {folder_choice.path})

Then run

folder_choice()

You should see a dialogue to choose a folder and after you have chosen it the dialogue box should disappear. Let me know if that works. If so I have updated the vision_ui code with a few updates so try it with the new version.

1 Like

#9

Thanks @amritv I’ll give it a try and let you know! If that doesn’t work, I’ll also see if switching browsers solves the problem for me. Thanks again!

0 Likes

#10

Hi @amritv I tried a few different things and it still doesn’t work for me. It always freezes up right after I select the folder. I tried the code you provided and reinstalling fastai (dev) and Vision_UI a few times, but no luck. I’ll continue to think of what might be off on my side. Thanks again! I’ll be keeping an eye out for updates!

2 Likes

(Amrit ) #12

Vision_UI now works on Google Colab (not with the full same functionality…yet)

Colab_UI

colab
https://colab.research.google.com/drive/1O_H41XhABAEQxg_p8KZd_BCQ8pj-eJX6

1 Like

(Antonin Sumner) #13

Hey Amrit, great work.

I have trouble making it work:
I can’t use “Choose Folder”
Here’s the error I get:


TclError Traceback (most recent call last)
/storage/Projects/Hubble/Vision_UI/vision_ui.py in on_button_clicked_info1(b)
534 with out:
535 clear_output()
–> 536 path_choice()
537 il = ImageList.from_folder(path_choice.path)
538 print(f’No of items in folder: {len(il.items)}’)

/storage/Projects/Hubble/Vision_UI/vision_ui.py in path_choice()
36
37 def path_choice():
—> 38 root = Tk()
39 path_choice.path = askdirectory(title=‘Select Folder’)
40 root.destroy()

/opt/conda/envs/fastai/lib/python3.6/tkinter/init.py in init(self, screenName, baseName, className, useTk, sync, use)
2021 baseName = baseName + ext
2022 interactive = 0
-> 2023 self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
2024 if useTk:
2025 self._loadtk()

TclError: no display name and no $DISPLAY environment variable

I’m running it on a Paperspace Notebook.

0 Likes

(Amrit ) #14

Hey @Brainkite cheers for the feedback!

I unfortunately do not use paperspace so cannot be fully certain about this but the same issue occurred when this was run on Colab.

Tk creates a new window in order to display the box to choose the folder. Because Colab is run on the cloud it cannot open a new window This resulted in the same error (and assuming that is the reason for the error in Paperspace) so I had to adapt the Colab version (Fastai graphical user interface for Google Colab) and use another method of choosing your folder. This version may not work on Paperspace as it uses Google.colab.widgets.

I modified the code and would really appreciate it if you can try it now on paperspace. Like I mentioned I have not tested it on paperspace but the path can now be set by ‘coping and pasting’. This should for the time being by-pass the need for using tkinter.

I uploaded paperspace_ui.py on my github (https://github.com/asvcode/Vision_UI) and would really appreciate if you could see if this works.

For setting your path copy and paste into this tab
paperspace

and likewise for choosing the image in the augmentations tab - copy and paste the image path

This should for the time being by pass the display issues you are experiencing. Let me know.

Thanks

0 Likes

(Antonin Sumner) #15

Thanks!
Here is the error I get when loading a path:


NameError Traceback (most recent call last)
/storage/Projects/Hubble/Vision_UI/paperspace_ui.py in on_button_clicked_summary(b)
604
605 def on_button_clicked_summary(b):
–> 606 path_load()
607
608 button_choice.on_click(on_button_clicked_summary)

/storage/Projects/Hubble/Vision_UI/paperspace_ui.py in path_load()
577 path_load.path_choice = file_location
578
–> 579 il = ImageList.from_folder(path_load.path_choice)
580 print(len(il.items))
581 print(path_load.path_choice)

NameError: name ‘ImageList’ is not defined

0 Likes

(Amrit ) #16

What version of fastai are you using?

You should be able to click on the ‘info’ tab and press the ‘system’ button to get that info

0 Likes

(Antonin Sumner) #17

Fastai Version: 1.0.58

0 Likes

(Amrit ) #18

That is odd. With your version it should work, as per https://github.com/fastai/fastai/blob/master/CHANGES.md, however your error may indicate you have an older version

1.0.46 (2019-02-25)

Breaking change:

  • In CollabDataBunch , pct_val is renamed valid_pct for consistency
  • ImageItemList becomes ImageList for consistency with TextList and TabularList
  • load_learner will fail for exported (pickled) models with error “AttributeError: Can’t get attribute ‘ImageItemList’ on module ‘fastai.vision.data’”. You will need to re-export with version 1.0.46 or use 1.0.44

ImageList is defined under data.py in the vision folder. Any way you can check to see if it is defined there?

0 Likes

(Lankinen) #19

I’m not sure if you are already doing this but it would be valuable to get the code exported to the cell. So for example if someone makes some augmentations and model it could be seen as a code in the cell. This way everyone could use this as a starting point because it is writing the basic code and then they could customize it anyways because it’s written in normal Python.

3 Likes

#20

This looks very promising. Are you thinking about making a version for fastai v2?

1 Like

(Amrit ) #21

The goal of Visual GUI was really to move away from the coding proponents but this is an interesting proposition. An addition of a button to view the code can be added. Will look into it - thanks for the suggestion

2 Likes