JunchuanYu commited on
Commit
280e720
1 Parent(s): 2749b49

Update run.py

Browse files
Files changed (1) hide show
  1. run.py +0 -37
run.py CHANGED
@@ -18,43 +18,6 @@ loc =hf_hub_download(repo_id="JunchuanYu/files_for_segmentRS", filename="utils.p
18
  sys.path.append(loc)
19
  from utils import *
20
 
21
- sam_checkpoint ="sam_vit_b_01ec64.pth"
22
- # sam_checkpoint = "sam_vit_h_4b8939.pth"
23
- device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') # use GPU if available
24
- model_type = "vit_b"
25
- sam = sam_model_registry[model_type](checkpoint=sam_checkpoint)
26
- sam.to(device=device)
27
- predictor = SamPredictor(sam)
28
- logging.basicConfig(filename="app.log", level=logging.INFO)
29
-
30
- title=(
31
- """
32
- # <p align="center"> Segment-RS 🛰️ <b>
33
- ## <p align="center"> A remote sensing interactive interpretation tools based on segment-anything (SAM 👍) <b>
34
- ### <p align="center"> YJC (yujunchuan@mail.cgs.gov.cn) 📧<b>
35
- """
36
- )
37
- description =(
38
- """
39
- Segment-RS is an interactive remote sensing interpretation tool that has been developed based on [SAM](https://github.com/facebookresearch/segment-anything). It allows for the real-time extraction of various remote sensing targets through interaction. Segment-RS is equipped with two interpretation models, namely, interactive extraction and automatic extraction.
40
- * Interactive extraction involves manually selecting samples (positive and negative) from the image to extract obvious targets. It should be emphasized that this manual interaction method is suitable for extracting an independent target in the scene and not suitable for extracting multiple targets of the same type at once as it is still under development.
41
- * Automatic extraction does not require any interaction, one can simply click the "Auto Segment" button to get the segmentation result. Additionally, the accuracy and granularity of segmentation can be adjusted through "Prediction Thresh" and "Points Per Side".
42
- """
43
- )
44
- descriptionend=(
45
- """
46
- <div align=center><img src="https://em-content.zobj.net/source/microsoft-teams/337/robot_1f916.png" style="width:5%;"></div>
47
- <br />
48
- <div align=center>you can follow the WeChat public account [45度科研人] and leave me a message! </div>
49
- <br />
50
- <div style="display:flex; justify-content:center;">
51
- <img src="https://dunazo.oss-cn-beijing.aliyuncs.com/blog/wechat-simple.png" style="margin-right:25px;width:200px;height:200px;">
52
- <div style="width:25px;"></div>
53
- <img src="https://dunazo.oss-cn-beijing.aliyuncs.com/blog/shoukuanma222.png" style="margin-left:25px;width:170px;height:190px;">
54
- </div>
55
- """
56
- )
57
-
58
  with gr.Blocks(theme='gradio/soft') as demo:
59
  gr.Markdown(title)
60
  with gr.Accordion("Instructions For User 👉", open=False):
 
18
  sys.path.append(loc)
19
  from utils import *
20
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  with gr.Blocks(theme='gradio/soft') as demo:
22
  gr.Markdown(title)
23
  with gr.Accordion("Instructions For User 👉", open=False):