Visual GUI

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

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!

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

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!

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

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

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.

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

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

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

Fastai Version: 1.0.58

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?

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

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

1 Like

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

For sure, currently working on understanding v2 first and then taking a stab at a v2 version.

1 Like

Made a number of additions, inclusion of _from folder is now included, a number of augmentations are also included [cutout, jitter, contrast, brightness, rotate, symmetric warp, padding] now has a ‘Code’ tab @Lankinen that updates (with a click of a button) when you make changes. @muellerzr was able to include Class Confusion. The classes pre populate for the class list and you can then choose which ones to select (image below). Currently there are about 30 changeable parameters (some still with glitches to work through). Now onwards to v2 :sweat_smile:

5 Likes

Hi amritv
Good Job!

mrfabulous1 :smiley::smiley:

1 Like

Visual_GUI now updated to fastai-v2 (not with all the functionality as v1…yet). Code tab included so you can view the code. Play around with numerous augmentation parameters and see the outcomes. Working on adding additional features and greater functionality as we move along with the course. https://github.com/asvcode/Vision_UI

img1a img2a img7a img6a

4 Likes

Visual UI now pip installable using the excellent nbdev. Totally impressed with the ease of use and functionality of nbdev and how you can so easily upload your package to pypi. I have to say that I thoroughly enjoyed creating the package using nbdev and the sense of achievement you get after you can pip install your own package is amazing! :smiley: https://pypi.org/project/fast-gui/

4 Likes