From 311b9e331c4e00fb4db02290ae2ec7a9279522dd Mon Sep 17 00:00:00 2001 From: rmdocherty Date: Fri, 12 Jan 2024 14:36:42 +0000 Subject: [PATCH 1/4] loadlabel input had same ref as loaddata so caused error - now separated and works --- frontend/src/components/Topbar.tsx | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/frontend/src/components/Topbar.tsx b/frontend/src/components/Topbar.tsx index 5a1ab6e..fa4580b 100644 --- a/frontend/src/components/Topbar.tsx +++ b/frontend/src/components/Topbar.tsx @@ -36,6 +36,7 @@ const Topbar = ({ loadFromFile, loadLabelFile, deleteAll, deleteCurrent, saveSeg postProcess: [, setPostProcess], } = useContext(AppContext)!; const fileInputRef = useRef(null); + const labelInputRef = useRef(null); const loadClassifierRef = useRef(null); // Common pattern for opening file dialog w/ button: hidden who is clicked when button is clicked. @@ -45,6 +46,12 @@ const Topbar = ({ loadFromFile, loadLabelFile, deleteAll, deleteCurrent, saveSeg } } + const addLabel = () => { + if (labelInputRef.current) { + labelInputRef.current.click(); + } + } + const loadClassifierClick = () => { if (loadClassifierRef.current) { loadClassifierRef.current.click(); @@ -109,19 +116,19 @@ const Topbar = ({ loadFromFile, loadLabelFile, deleteAll, deleteCurrent, saveSeg Load Image(s) handleFileUpload(e, "image")} /> - Load Labels - Remove Image - setLabelType("Crop")}>Crop + Load Labels handleFileUpload(e, "label")} /> + Remove Image + setLabelType("Crop")}>Crop Clear All From 306f7c119719f0477d6694bd6d0b7a82186a5c3b Mon Sep 17 00:00:00 2001 From: rmdocherty Date: Thu, 18 Jan 2024 09:24:24 +0000 Subject: [PATCH 2/4] update gitignore --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 1f6be58..2d4f36f 100644 --- a/.gitignore +++ b/.gitignore @@ -20,4 +20,5 @@ yarn.lock *backend/test_resources/test_outputs/*.png *.env* samba_logo/* -backend/17* \ No newline at end of file +backend/17* +scripts/* \ No newline at end of file From 63c7e6f14282e40bbdbe8f260fd9517a55b430c4 Mon Sep 17 00:00:00 2001 From: rmdocherty Date: Thu, 18 Jan 2024 09:48:49 +0000 Subject: [PATCH 3/4] Fixed URL for manual links and made clicking open a new tab --- frontend/src/components/Modals.tsx | 2 +- frontend/src/components/Topbar.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/Modals.tsx b/frontend/src/components/Modals.tsx index 5a6d91b..aa3ddcd 100644 --- a/frontend/src/components/Modals.tsx +++ b/frontend/src/components/Modals.tsx @@ -100,7 +100,7 @@ const WelcomeModalContent = () => {

SAMBA is a web-based trainable segmentation app. It has deep-learning powered label suggestions and a random-forest classifier backend.

-

Load an image, choose your brush on the sidebar and place some labels with left click. Zoom with the scroll wheel and pan with arrow keys or WASD. Right click to change the smart label focus size or to finish a polygon. Once you've labelled an example of each class, press "Train Classifier" to segment the image. If you still need help, check out the manual or watch a video tutorial. Have fun!

+

Load an image, choose your brush on the sidebar and place some labels with left click. Zoom with the scroll wheel and pan with arrow keys or WASD. Right click to change the smart label focus size or to finish a polygon. Once you've labelled an example of each class, press "Train Classifier" to segment the image. If you still need help, check out the manual or watch a video tutorial. Have fun!

Hotkeys:

  • Left Click: place label/polygon point. Hold to draw brush stroke, release to finish.
  • diff --git a/frontend/src/components/Topbar.tsx b/frontend/src/components/Topbar.tsx index fa4580b..3edbfe0 100644 --- a/frontend/src/components/Topbar.tsx +++ b/frontend/src/components/Topbar.tsx @@ -87,7 +87,7 @@ const Topbar = ({ loadFromFile, loadLabelFile, deleteAll, deleteCurrent, saveSeg ["Settings", "settings.png", "", ''], ["Gallery", "gallery.png", "", ''], ["Paper", "paper.png", "coming_soon", '_blank'], - ["Help", "help.png", "https://github.com/tldr-group/samba-web/blob/development/MANUAL.md", '_blank'], + ["Help", "help.png", "https://github.com/tldr-group/samba-web/blob/main/MANUAL.md", '_blank'], ["Contact", "mail.png", "", ""], ["TLDR Group", "tldr.png", "https://tldr-group.github.io/#/", '_blank'] ] From 146609f8058713692b4d84c1104d192bfd11f10f Mon Sep 17 00:00:00 2001 From: rmdocherty Date: Fri, 19 Jan 2024 16:57:17 +0000 Subject: [PATCH 4/4] small update to README to trigger cache reload on gifs --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 7dda55f..dd6e892 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,6 @@ ![Tests](https://github.com/tldr-group/samba-web/actions/workflows/tests.yml/badge.svg) - `SAMBA` (Segment Anything Model Based App) is a trainable segmentation tool for materials science that uses [deep learning](https://github.com/facebookresearch/segment-anything) for fast, high-quality labels and random forests for robust, generalizable segmentations. It is accessible in the browser ([https://www.sambasegment.com](https://www.sambasegment.com)), without the need to download any external dependencies. This repo is a local version of the website which contains the frontend for the website (React + TSX) and the backend (Python + Flask). The frontend handles labelling and the backend sends back SAM embeddings (if requested) and segmentations.