Comments (8)
So how do I import LangSam, I seem to be running into a similar error, "NameError: name 'SLConfig' is not defined"
from segment-geospatial.
,Boss, I also encountered this problem, how to solve it?
from segment-geospatial.
groundingdino
is not yet available on conda-forge. It can't be added to requirements.txt as the conda-forge package will fail to build if it is included.
huggingface_hub
can potentially be added. I will look into it.
from segment-geospatial.
I looked in the package files and found that there is only one class, name "SamGeo". If you write "from samgeo import SamGeo", your issues should be resolved. I assume that there may have been a seperate class named "LangSAM" that was deprecated.
from segment-geospatial.
huggingface_hub has been added to requirements.txt. #87
GroundingDINO and supervision are being added to conda-forge (conda-forge/staged-recipes#22907). It can be added to requirements.txt once they become available on conda-forge.
from segment-geospatial.
I looked in the package files and found that there is only one class, name "SamGeo". If you write "from samgeo import SamGeo", your issues should be resolved. I assume that there may have been a seperate class named "LangSAM" that was deprecated.
I like how you're thinking but LangSAM is a class in samgeo/text_sam.py, thus the import statement in text_prompts.ipynb:
from samgeo.text_sam import LangSAM
I updated to 0.8.1 and now get an OSError thrown by GroundingDINO:
File C:\Users\username\AppData\Local\ESRI\conda\envs\arcgispro-py3-samgeo\lib\site-packages\groundingdino\util\slconfig.py, in _file2dict:
Line 104: raise IOError("Only py/yml/yaml/json type are supported now!")
OSError: Only py/yml/yaml/json type are supported now!
Looks to be something with what LangSAM is using as cache_config_file
in SLConfig.fromfile(cache_config_file)
from segment-geospatial.
I think I found the source of the problem with text_sam.load_model_hf()
When I run the huggingface_hub.hf_hub_download function in the ArcGIS Pro notebook, the cached file path is something like this:
C:\\Users\\username/.cache\\huggingface\\hub\\c593cfe8389419176fe6d2a7b3fb5f2a87fb4a45a7c780ef37813742c4910f49.3b220b33a5e67bbef5a685c9dd805f05aa7f36bc592cf143628033f6f6c7e61b
Not sure why this is in a hashed/hex(?) form but obviously that's why SLConfig doesn't see a .py file.
If we use the force_filename parameter with hf_hub_download() we can ensure the output filename is the same as the input. Applicable here and here.
from segment-geospatial.
So how do I import LangSam, I seem to be running into a similar error, "NameError: name 'SLConfig' is not defined"
I solved SLConfig is not defined by directly cloning GroundingDINO repo and install it directly.
# uninstall groundingdino-py
pip uninstall groundingdino-py
# install GroundingDINO from github
git clone https://github.com/IDEA-Research/GroundingDINO.git
cd GroundingDINO/
pip install -e .
from segment-geospatial.
Related Issues (20)
- Mask from automatic mask generator with batch mode not working
- samgeo.hq_sam not working in docker HOT 4
- Add SAM-based object detection using selecting just one sample of a class HOT 2
- Add support for EfficientSAM
- samgeo fails to load in conda/mamba environment HOT 1
- self.save_masks unique value mask results are covered HOT 1
- Initialise FastSAM is not working HOT 7
- samgeo installation failed on arcggis pro 2.9 HOT 2
- Problem with the Interactive segmentation using Points on Image HOT 1
- Arcgis Pro 3.2 samgeo installation error: rumtime error HOT 1
- batch predict
- sam.generate(): Error with uploaded images HOT 2
- warning libmamba Added empty dependency for problem type SOLVER_RULE_UPDATE Could not solve for environment specs The following package could not be installed └─ segment-geospatial is installable and it requires └─ pycocotools with the potential options HOT 5
- SamGeo() cannot download model vit_h (samgeo.hq_sam) HOT 7
- Expose leafmap backend options to user HOT 7
- exception when using box prompt
- ImportError: DLL load failed while importing etree: The specified procedure could not be found. HOT 1
- Add support for Clay Foundation Model
- ArcPro 3.2.2 Install Error HOT 1
- Is using headless opencv an option? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from segment-geospatial.