Origami-Cloudless-AI / TinyMLaaS-2023-winter

Run Hello World of TensorFlow Lite for micro automatically in Docker
https://Origami-TinyML.github.io/tflm_hello_world
Apache License 2.0
1 stars 2 forks source link

Designing more polished UI with Streamlit #87

Closed nellatuulikki closed 1 year ago

nellatuulikki commented 1 year ago
  1. User can choose the model
  2. Button for compiling
  3. Button for installing
  4. Visualization of the pipeline (first 6 steps of the life cycle to the home page)
  5. Map element, similar to https://streamlit-demo-uber-nyc-pickups-streamlit-app-456wus.streamlit.app/ but this can be animated
doyu commented 1 year ago

You can control color of Streamlit via https://docs.streamlit.io/library/advanced-features/theming

doyu commented 1 year ago

https://youtu.be/wyWmWaXapmI?t=4960

doyu commented 1 year ago

Real time drawing when IoT devices are moving

https://github.com/ash2shukla/streamlit-stream https://blog.streamlit.io/how-to-build-a-real-time-live-dashboard-with-streamlit/

FexbYk23 commented 1 year ago

For number 4 I found this: https://github.com/Mohamed-512/Extra-Streamlit-Components

The TabBar and StepperBar both seem like decent options, but both have their flaws. The TabBar has no logic for preventing the user from choosing tabs out of order and the StepperBar has no option to set the default value.

doyu commented 1 year ago

I suppose that choosing order may not be so important here. Basically the flow itself seems to have been already kinda self-explanative in the order of the current side bar menus items. IIUC, Roberto wanted that the frontpage should present which items are choosen in each phase? Or do you want to replace the side bar with pipeline? @robertmora confirm here? Any visual example in your mind?

IMHO, at worst, this could be satisfied even only with each page puttuing what's choosen on the top of its page, if available visual pipelining options are somewhat too overengineering (i.e. big effort on visualization). Although we, of course, want decent UI but we have originally choosen Steramlit for the trade-off point between effort and easiness. IOW, if we really want an ultimate fancy UI, we should have gone with React or something from the biginning. But that's not our target, at least, for now. We really want to tell our story to investors with this app, what we wil achieve for customers ;)

To decide which solution / UI to take, @robertmora should provide somewhat more info here.

doyu commented 1 year ago

For 5, an example of simple real time updating: image

Or https://towardsdatascience.com/simple-plotly-tutorials-868bd0890b8b

robertmora commented 1 year ago

I can discuss with the team about this tomorrow as well. Anyway, my idea was to still keep the sidebar with pipeline items and in the front/home page placing this sort of step bar that provides an overview of the current operations/tasks if a new pipeline process or an pipeline step updated is being executed.

animated-step-progress-bar-pure-javascript

But, at this stage, if it requires too much time, let's forget about it and let's try to focus on low hanging fruit activities.

In general, the platform should always be able to provide an overview about all the devices connected in the TinyMLaaS tab. Then, as soon as the user wants to add a new device and/or install a new version of the ML model in a specific device and/or compile with a different quantization and/or select a different data source for device, etc., it should be able to start a new process (can't come up with a proper name for it) that allows to do perform the whole pipeline or a single task. So, thinking at the big picture, I do see the platform and each sidebar item (a complete version of if, so not something that should be implemented for this sprint) providing the following capabilities:

TinyMLaaS

Devices

Data

Model

Training

Compiling

Installing

Observing

doyu commented 1 year ago

My idea was to still keep the sidebar with pipeline items and in the front/home page placing this sort of step bar that provides an overview of the current operations/tasks if a new pipeline process or an pipeline step updated is being executed.

One way to do this with the current side bar may be using session state[1]. With keeping the phase transition history in this session state, each side bar item (each phase) could have been marked checked / unchecked icon at the top of item line, which indicates done or to-be-done state respectively. Even some pull down menu under each item would show what options were choosen so far in those phase too. If we successfuly put all of such info in side bar, which is always visibule, we might not need visual pipeline on the frontpage? Then what's on the front page???? I have no idea, right now, though ;) ..... Any opinion?

[1] https://docs.streamlit.io/library/api-reference/session-state

robertmora commented 1 year ago

The front page could easily show this:

– Connected devices: This tab provides a list of all the devices that are currently connected to the platform. It could also display basic information about each device, such as its name, status, and location. – Device map: This tab displays a map that shows the locations of all the connected devices. This could be useful for users who want to quickly locate a device and see its status.

(The idea would be that our TinyMLaaS customer must manage a relative big number of devices.)

doyu commented 1 year ago

– Connected devices: This tab provides a list of all the devices that are currently connected to the platform. It could also display basic information about each device, such as its name, status, and location. – Device map: This tab displays a map that shows the locations of all the connected devices. This could be useful for users who want to quickly locate a device and see its status.

A Device map followed by (connected) Device table below would look cooler. Device map may show green dots for connected device while red dots for not connected ones. If you click a red / green dot, the detail info should be listed on the top of table below, for example :D All of this feasibility depends on implementation effort, though.

Logically the above info belongs to Device page in principle, but it would look cool if the front page shows the above info on live :) Actual Device page could show its device registration form and a list of registered devices in a table simply, then.

robertmora commented 1 year ago

Yes yes, that was exactly my idea ;) The front page should provide an overview about the devices registered into the network (online and offline), the ones reporting errors, the ones reporting data drift risks, the ones having low-battery, the ones having poor connectivity, etc. Differently, the Device page would be the interface for dealing with the device registration, update, etc, as wrote above.

doyu commented 1 year ago

I checked st.map(). It doesn't have much complicated features. It doesn't seem to have red/green entities. We could go with st.map() now and if we need more sophistocated feature, we could consider later.

robertmora commented 1 year ago

Text for tabs description:

TinyMLaaS displays a list of all the devices that are connected to the platform. Users can view the locations of these devices on a map. It also allows users to manage and monitor their devices, including adding new devices, removing devices, and checking the status of each device.

Device displays a list of all the devices that are connected to the platform. Users can add new devices to the platform and select an existing device for installing or updating an ML model. It also enables users to manage their devices, including viewing device information, modifying device settings, and monitoring device status.

Data allows users to select the data source that corresponds to the device selected in the previous pipeline step (i.e., Device). Users can choose from different data sources, including sensors, cameras, or other input devices. It also ensures that the selected data source is compatible with the device and the ML model.

Model enables users to select the ML model they want to install on the device. Users can choose from different pre-built models or upload their own custom models. Users can also select the quantization level and other parameters of the ML model. It also ensures that the selected ML model is compatible with the selected data source and device.

Training allows users to train the selected ML model. Users can choose from different training algorithms, hyperparameters, and other settings. It also ensures that the ML model is trained properly and can achieve the desired accuracy and performance.

Compiling enables users to compile the selected ML model for the target device. Users can select the compilation settings, including the target architecture, optimization level, and other options. It also ensures that the compiled model is optimized for the target device and can run efficiently.

Installing allows users to install the compiled ML model on the target device. Users can select the device and the compiled model, and monitor the installation process. It also ensures that the compiled model is installed correctly on the target device and can run as expected.

Observing enables users to observe the selected device in action, while using the installed ML model and processing the selected data input. Users can view the output of the ML model, including predictions, classifications, or other results. It also allows users to monitor the performance of the ML model and the device in real-time.

doyu commented 1 year ago

TinyMLaaS displays a list of all the devices that are connected to the platform. Users can view the locations of these devices on a map. It also allows users to manage and monitor their devices, including adding new devices, removing devices, and checking the status of each device.

We consider this front page, TinyMLaaS, as dash board of WebApp. This should show the overall information about registered devices and some statistical data (e.g. # of devices, # of observatios, total # of detected human and so on). But this page shouldn't provide any control feature itself. control feature should be done in each sub pages. Adding new device should be done in Device subpage.

Device displays a list of all the devices that are connected to the platform. Users can add new devices to the platform and select an existing device for installing or updating an ML model. It also enables users to manage their devices, including viewing device information, modifying device settings, and monitoring device status.

As we discussed above, basically subpages are flow from top to bottom. We still don't associate a device with other entities yet here (e.g. Model, Data, Installer) yet. That kind of association should be done later in Installaing.

doyu commented 1 year ago

Data allows users to select the data source that corresponds to the device selected in the previous pipeline step (i.e., Device). Users can choose from different data sources, including sensors, cameras, or other input devices. It also ensures that the selected data source is compatible with the device and the ML model.

I may think that there are 2 data soruce here. Existing public dataset (e.g. human detection dataset stored in S3) and data (set) collected newly from own sensors. Either way, both data have to be stored in storage with label once. Once it's stored in S3, this dataset could be trained in training in the same way. We don't want to deal both dataset differently so that, any data should be stored in S3 with label once, before proceeding to Training

In the case of collecting data from sensor, we need some UI to check image data and put label on it before storing in storage.

doyu commented 1 year ago

Model enables users to select the ML model they want to install on the device. Users can choose from different pre-built models or upload their own custom models. Users can also select the quantization level and other parameters of the ML model. It also ensures that the selected ML model is compatible with the selected data source and device.

quantization is not yet in this phase. quantization level shoud be configured in Compiling phase.

doyu commented 1 year ago

Training allows users to train the selected ML model. Users can choose from different training algorithms, hyperparameters, and other settings. It also ensures that the ML model is trained properly and can achieve the desired accuracy and performance.

This is the place you'll select dataset and model for the 1st time. They sholud not be choosen in any of previous phases.

robertmora commented 1 year ago

Good points but IMHO each tab should provide interactive features that point to the other steps of the pipeline. For example, if I'm in the TinyMLaaS front page and a click on a device in the map, as user I would be happy to see a popup menu (i think that technically is called "context menu") that says "update device" and that brings me to the "Device" tab then for processing the specific task. Also, I should be able to remove a device from TinyMLaaS dashboard map (still through the map for example). But that's how I would see this as user of the platform. I agree that "adding" can be removed though.

Same applies for "Data" tab. From there I should be able to have a pointer that brings me to the Model part if I wish to do update the already installed model.

Each tab, still IMHO, should have a pointer/interactions to other tabs. It helps users on finding in a more easy way what they would like to do.

doyu commented 1 year ago

Compiling enables users to compile the selected ML model for the target device. Users can select the compilation settings, including the target architecture, optimization level, and other options. It also ensures that the compiled model is optimized for the target device and can run efficiently.

Still we shouldn't configure anything for the specific device yet here. Device specific configuration should be done in Installing phase since that's the place to generate an installable OS image. Here, Compiling means to convert a trained ML model into TFLite format. That's indepedent of CPU arch / device at all.

robertmora commented 1 year ago

quantization is not yet in this phase. quantization level shoud be configured in Compiling phase.

What about if I've already trained a model with two different types of quantization and these models are already stored? From where I can simply tick a box for selecting that model with re-compiling it?

robertmora commented 1 year ago

This is the place you'll select dataset and model for the 1st time. They sholud not be choosen in any of previous phases.

Why?

doyu commented 1 year ago

Installing allows users to install the compiled ML model on the target device. Users can select the device and the compiled model, and monitor the installation process. It also ensures that the compiled model is installed correctly on the target device and can run as expected.

This is the 1st place to generate an installable OS image for a specific device. This image sholud include TinyML model in it, to be used by some app specific logic running in device. There's no arch dependency in any of previous phases.

robertmora commented 1 year ago

Still we shouldn't configure anything for the specific device yet here. Device specific configuration should be done in Installing phase since that's the place to generate an installable OS image. Here, Compiling means to convert a trained ML model into TFLite format. That's indepedent of CPU arch / device at all.

Then perhaps we should call it "Converter" rather than "Compiling"?

doyu commented 1 year ago

Each tab, still IMHO, should have a pointer/interactions to other tabs. It helps users on finding in a more easy way what they would like to do.

side-bar is always visible. As explained previously, each side-bar menu item is marked done or to-be-done. This would be the indicator for which phase you are on now.

doyu commented 1 year ago

What about if I've already trained a model with two different types of quantization and these models are already stored? From where I can simply tick a box for selecting that model with re-compiling it?

This should be handled in registration feature in model, and probably in Compiling too

doyu commented 1 year ago

image

This is because the side-bar is the execution order from top to bottom. You shouldn't touch configuration if it's not needed yet.

robertmora commented 1 year ago

This should be handled in registration feature in model, and probably in Compiling too

And that's exactly what was written before.

doyu commented 1 year ago

image

The ML compiler as-a-Service concept is the core of whole archtecture.

robertmora commented 1 year ago

But yeah, without spamming and confusing the team, perhaps it is easier if you take the text written before and you modify at your wish and based on your view.

doyu commented 1 year ago

But yeah, without spamming and confusing the team, perhaps it is easier if you take the text written before and you modify at your wish and based on your view.

True! Communication is not alway easy for me ;;^^

I should have provided some desgin guide for this item. Anyway, I'm so sorry for unnecessary confusion :(

doyu commented 1 year ago

Summarized the above discussion in one place, https://origami-tinyml.github.io/tflm_hello_world/ui-guide.html

Feel free to update the above with a PR.

matiasto commented 1 year ago

Status: Borna and I began working on this.