luisCartoGeo / GeoAI_Plugin

Plugin para ejecutar el modelo de META Segment Anything en QGIS
GNU General Public License v3.0
68 stars 9 forks source link

No se instala 'GeoAI_Plugin-main', problema con classFactory() #2

Open SoulCoding666 opened 10 months ago

SoulCoding666 commented 10 months ago

Hola, estoy intentando instalar el plugin pero no me funciona.

Instalé y actualicé QGIS vía OSGeo4W Shell, además de Pytorch 1.8.1+cu111 tal como aparece en las instrucciones, luego seguí con la descarga del código de GeoAI_plugin en .zip y lo cargué en la sección de complementos, y me salió este mensaje:

No se pudo cargar el complemento 'GeoAI_Plugin-main' debido a un error al llamar a su método classFactory(). Este mismo error me sucedió al intentar instalar otro plugin.

¿Cómo lo puedo solucionar?

De antemano muchas gracias. Abajo dejo el código de error por completo.

Saludos

Details

No se pudo cargar el complemento 'GeoAI_Plugin-main' debido a un error al llamar a su método classFactory() ModuleNotFoundError: No module named 'timm' Traceback (most recent call last): File "C:\PROGRA~1/QGIS32~1.12/apps/qgis-ltr/./python\qgis\utils.py", line 423, in _startPlugin plugins[packageName] = package.classFactory(iface) File "C:\Users/*****/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\GeoAI_Plugin-main\__init__.py", line 28, in classFactory from .ini_geoai import ini_geoai File "C:\PROGRA~1/QGIS32~1.12/apps/qgis-ltr/./python\qgis\utils.py", line 888, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "C:\Users/*****/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\GeoAI_Plugin-main\ini_geoai.py", line 21, in from .dialog_precarga import dialog_precarga File "C:\PROGRA~1/QGIS32~1.12/apps/qgis-ltr/./python\qgis\utils.py", line 888, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "C:\Users/*****/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\GeoAI_Plugin-main\dialog_precarga.py", line 35, in from .segment_fast import * File "C:\PROGRA~1/QGIS32~1.12/apps/qgis-ltr/./python\qgis\utils.py", line 888, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "C:\Users/*****/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\GeoAI_Plugin-main\segment_fast\__init__.py", line 7, in from .build_sam_f import ( File "C:\PROGRA~1/QGIS32~1.12/apps/qgis-ltr/./python\qgis\utils.py", line 888, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "C:\Users/*****/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\GeoAI_Plugin-main\segment_fast\build_sam_f.py", line 15, in from .modeling_f.tiny_vit_sam import TinyViT File "C:\PROGRA~1/QGIS32~1.12/apps/qgis-ltr/./python\qgis\utils.py", line 888, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "C:\Users/*****/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\GeoAI_Plugin-main\segment_fast\modeling_f\tiny_vit_sam.py", line 15, in from timm.models.layers import DropPath as TimmDropPath,\ File "C:\PROGRA~1/QGIS32~1.12/apps/qgis-ltr/./python\qgis\utils.py", line 888, in _import mod = _builtin_import(name, globals, locals, fromlist, level) ModuleNotFoundError: No module named 'timm' Versión de Python: 3.9.5 (tags/v3.9.5:0a7dcbd, May 3 2021, 17:27:52) [MSC v.1928 64 bit (AMD64)] Versión de QGIS: 3.28.14-Firenze Firenze, b09131c512 Ruta de Python: C:\Users/*****/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\open_lidar_tools C:\Users/*****/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\LAStools C:\Users/*****/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\AreaAlongVector C:/PROGRA~1/QGIS32~1.12/apps/qgis-ltr/./python C:/Users/*****/AppData/Roaming/QGIS/QGIS3\profiles\default/python C:/Users/*****/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins C:/PROGRA~1/QGIS32~1.12/apps/qgis-ltr/./python/plugins C:\PROGRA~1\QGIS32~1.12\apps\grass\grass83\etc\python C:\Users\*****\Documents C:\Program Files\QGIS 3.28.12\bin\python39.zip C:\PROGRA~1\QGIS32~1.12\apps\Python39\DLLs C:\PROGRA~1\QGIS32~1.12\apps\Python39\lib C:\Program Files\QGIS 3.28.12\bin C:\Users\*****\AppData\Roaming\Python\Python39\site-packages C:\PROGRA~1\QGIS32~1.12\apps\Python39 C:\PROGRA~1\QGIS32~1.12\apps\Python39\lib\site-packages C:\PROGRA~1\QGIS32~1.12\apps\Python39\lib\site-packages\win32 C:\PROGRA~1\QGIS32~1.12\apps\Python39\lib\site-packages\win32\lib C:\PROGRA~1\QGIS32~1.12\apps\Python39\lib\site-packages\Pythonwin C:/Users/*****/AppData/Roaming/QGIS/QGIS3\profiles\default/python C:\Users\*****\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\mmqgis/forms C:\Users/*****/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\rvt-qgis

luisCartoGeo commented 10 months ago

Hola SoulCoding666 lo que sucede es que genere una nueva versión incorporando una versión ligera y rápida del modelo SAM y aún no he actualizado la documentación del Github, aqui puedes leer los detalles articulo linkedin

Para solucionar el problema que comentas (si tu versión de QGIS es superior a la 3.16), simplemente abre el shell de OSGEO e introduce este código: pip install timm

faka069 commented 4 months ago

Hola, he intentado utilizar el complemento sobre qgis 3.28.11 No avanza mas allá del 10% y arroja el siguiente mensaje. A que puede deberse? Gracias!

Report Details

Python Stack Trace

Windows fatal exception: int divide by zero

Thread 0x00002878 (most recent call first):
  File "C:\OSGeo4W\apps\Python39\lib\multiprocessing\connection.py", line 310 in _recv_bytes
    waitres = _winapi.WaitForMultipleObjects(
  File "C:\OSGeo4W\apps\Python39\lib\multiprocessing\connection.py", line 255 in recv
    buf = self._recv_bytes()
  File "C:\OSGeo4W\apps\Python39\lib\multiprocessing\pool.py", line 576 in _handle_results
    task = get()
  File "C:\OSGeo4W\apps\Python39\lib\threading.py", line 892 in run
    self._target(*self._args, **self._kwargs)
  File "C:\OSGeo4W\apps\Python39\lib\threading.py", line 954 in _bootstrap_inner
    self.run()
  File "C:\OSGeo4W\apps\Python39\lib\threading.py", line 912 in _bootstrap
    self._bootstrap_inner()

Thread 0x00002864 (most recent call first):
  File "C:\OSGeo4W\apps\Python39\lib\multiprocessing\pool.py", line 528 in _handle_tasks
    for taskseq, set_length in iter(taskqueue.get, None):
  File "C:\OSGeo4W\apps\Python39\lib\threading.py", line 892 in run
    self._target(*self._args, **self._kwargs)
  File "C:\OSGeo4W\apps\Python39\lib\threading.py", line 954 in _bootstrap_inner
    self.run()
  File "C:\OSGeo4W\apps\Python39\lib\threading.py", line 912 in _bootstrap
    self._bootstrap_inner()

Thread 0x00002934 (most recent call first):
  File "C:\OSGeo4W\apps\Python39\lib\multiprocessing\connection.py", line 816 in _exhaustive_wait
    res = _winapi.WaitForMultipleObjects(L, False, timeout)
  File "C:\OSGeo4W\apps\Python39\lib\multiprocessing\connection.py", line 884 in wait
    ready_handles = _exhaustive_wait(waithandle_to_obj.keys(), timeout)
  File "C:\OSGeo4W\apps\Python39\lib\multiprocessing\pool.py", line 499 in _wait_for_updates
    wait(sentinels, timeout=timeout)
  File "C:\OSGeo4W\apps\Python39\lib\multiprocessing\pool.py", line 519 in _handle_workers
    cls._wait_for_updates(current_sentinels, change_notifier)
  File "C:\OSGeo4W\apps\Python39\lib\threading.py", line 892 in run
    self._target(*self._args, **self._kwargs)
  File "C:\OSGeo4W\apps\Python39\lib\threading.py", line 954 in _bootstrap_inner
    self.run()
  File "C:\OSGeo4W\apps\Python39\lib\threading.py", line 912 in _bootstrap
    self._bootstrap_inner()

Current thread 0x00001d10 (most recent call first):
  File "C:\OSGeo4W\apps\Python39\lib\site-packages\torch\nn\modules\conv.py", line 456 in _conv_forward
    return F.conv2d(input, weight, bias, self.stride,
  File "C:\OSGeo4W\apps\Python39\lib\site-packages\torch\nn\modules\conv.py", line 460 in forward
    return self._conv_forward(input, self.weight, self.bias)
  File "C:\OSGeo4W\apps\Python39\lib\site-packages\torch\nn\modules\module.py", line 1541 in _call_impl
    return forward_call(*args, **kwargs)
  File "C:\OSGeo4W\apps\Python39\lib\site-packages\torch\nn\modules\module.py", line 1532 in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
  File "C:\Users/Facundo/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\GeoAI_Plugin-main\segment_anything\modeling\image_encoder.py", line 392 in forward
    x = self.proj(x)
  File "C:\OSGeo4W\apps\Python39\lib\site-packages\torch\nn\modules\module.py", line 1541 in _call_impl
    return forward_call(*args, **kwargs)
  File "C:\OSGeo4W\apps\Python39\lib\site-packages\torch\nn\modules\module.py", line 1532 in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
  File "C:\Users/Facundo/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\GeoAI_Plugin-main\segment_anything\modeling\image_encoder.py", line 107 in forward
    x = self.patch_embed(x)
  File "C:\OSGeo4W\apps\Python39\lib\site-packages\torch\nn\modules\module.py", line 1541 in _call_impl
    return forward_call(*args, **kwargs)
  File "C:\OSGeo4W\apps\Python39\lib\site-packages\torch\nn\modules\module.py", line 1532 in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
  File "C:\Users/Facundo/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\GeoAI_Plugin-main\segment_anything\predictor.py", line 89 in set_torch_image
    self.features = self.model.image_encoder(input_image)
  File "C:\OSGeo4W\apps\Python39\lib\site-packages\torch\utils\_contextlib.py", line 115 in decorate_context
    return func(*args, **kwargs)
  File "C:\Users/Facundo/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\GeoAI_Plugin-main\segment_anything\predictor.py", line 60 in set_image
    self.set_torch_image(input_image_torch, image.shape[:2])
  File "C:\Users/Facundo/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\GeoAI_Plugin-main\dialog_precarga.py", line 215 in ejecutar
    predictor.set_image(arreglo)

Stack Trace


torch::ModuleDef::unsafe_arena_set_allocated_torchscript_arena :
torch::ModuleDef::unsafe_arena_set_allocated_torchscript_arena :
torch::ModuleDef::unsafe_arena_set_allocated_torchscript_arena :
torch::ModuleDef::unsafe_arena_set_allocated_torchscript_arena :
torch::ModuleDef::unsafe_arena_set_allocated_torchscript_arena :
torch::ModuleDef::unsafe_arena_set_allocated_torchscript_arena :
torch::ModuleDef::unsafe_arena_set_allocated_torchscript_arena :
torch::ModuleDef::unsafe_arena_set_allocated_torchscript_arena :
torch::ModuleDef::unsafe_arena_set_allocated_torchscript_arena :
torch::ModuleDef::unsafe_arena_set_allocated_torchscript_arena :
at::native::hardtanh_quantized_cpu_ :
PackedConvWeight<3>::GetQuantizationParams :
PackedConvWeight<3>::apply_relu :
at::native::hardtanh_quantized_cpu_ :
at::native::mkldnn_mul_out :
at::native::mkldnn_mul_out :
at::native::mkldnn_mul_out :
at::native::mkldnn_convolution :
at::compositeexplicitautograd::view_copy_symint_outf :
at::compositeexplicitautograd::bucketize_outf :
at::TensorMaker::make_tensor :
at::_ops::mkldnn_convolution::call :
at::native::_convolution :
at::compositeexplicitautograd::view_copy_symint_outf :
at::compositeexplicitautograd::bucketize_outf :
at::TensorMaker::make_tensor :
at::_ops::_convolution::call :
at::native::sym_size :
at::native::convolution :
at::compositeexplicitautograd::view_copy_symint_outf :
at::compositeexplicitautograd::bucketize_outf :
at::TensorMaker::make_tensor :
at::TensorMaker::make_tensor :
at::_ops::convolution::redispatch :
torch::autograd::CopySlices::~CopySlices :
torch::autograd::CopySlices::~CopySlices :
at::TensorMaker::make_tensor :
at::_ops::convolution::call :
at::native::conv2d_symint :
at::compositeimplicitautograd::where :
at::compositeimplicitautograd::broadcast_to_symint :
at::TensorMaker::make_tensor :
at::_ops::conv2d::call :
THPPointer<_object>::release :
THPPointer<_object>::release :
PyArg_ParseTuple_SizeT :
PyEval_EvalFrameDefault :
PyFloat_FromDouble :
PyEval_EvalFrameDefault :
PyFunction_Vectorcall :
PyFloat_FromDouble :
PyVectorcall_Call :
PyObject_Call :
PyEval_EvalFrameDefault :
PyObject_GC_Del :
PyFunction_Vectorcall :
PyFloat_FromDouble :
PyVectorcall_Call :
PyObject_Call :
PyEval_EvalFrameDefault :
PyObject_GC_Del :
PyFunction_Vectorcall :
PyObject_FastCallDictTstate :
PyObject_Call_Prepend :
PyEval_EvalCodeEx :
PyEval_EvalFrameDefault :
PyFunction_Vectorcall :
PyFloat_FromDouble :
PyVectorcall_Call :
PyObject_Call :
PyEval_EvalFrameDefault :
PyObject_GC_Del :
PyFunction_Vectorcall :
PyFloat_FromDouble :
PyVectorcall_Call :
PyObject_Call :
PyEval_EvalFrameDefault :
PyObject_GC_Del :
PyFunction_Vectorcall :
PyObject_FastCallDictTstate :
PyObject_Call_Prepend :
PyEval_EvalCodeEx :
PyEval_EvalFrameDefault :
PyFunction_Vectorcall :
PyFloat_FromDouble :
PyVectorcall_Call :
PyObject_Call :
PyEval_EvalFrameDefault :
PyObject_GC_Del :
PyFunction_Vectorcall :
PyFloat_FromDouble :
PyVectorcall_Call :
PyObject_Call :
PyEval_EvalFrameDefault :
PyObject_GC_Del :
PyFunction_Vectorcall :
PyObject_FastCallDictTstate :
PyObject_Call_Prepend :
PyEval_EvalCodeEx :
PyEval_EvalFrameDefault :
PyFunction_Vectorcall :
PyVectorcall_Call :
PyObject_Call :
PyEval_EvalFrameDefault :
PyObject_GC_Del :
PyEval_EvalFrameDefault :
PyObject_GC_Del :
PyEval_EvalFrameDefault :
PyFunction_Vectorcall :
PyFloat_FromDouble :
PyVectorcall_Call :
PyObject_Call :
PyInit_QtCore :
PyInit_QtCore :
PyInit_QtCore :
PyInit_QtCore :
QObject::qt_static_metacall :
QAbstractButton::clicked :
QAbstractButton::click :
QAbstractButton::mouseReleaseEvent :
PyInit_QtWidgets :
QWidget::event :
PyInit_QtWidgets :
QApplicationPrivate::notify_helper :
QApplication::notify :
QgsApplication::notify :
QCoreApplication::notifyInternal2 :
QApplicationPrivate::sendMouseEvent :
QSizePolicy::QSizePolicy :
QSizePolicy::QSizePolicy :
QApplicationPrivate::notify_helper :
QApplication::notify :
QgsApplication::notify :
QCoreApplication::notifyInternal2 :
QGuiApplicationPrivate::processMouseEvent :
QWindowSystemInterface::sendWindowSystemEvents :
QEventDispatcherWin32::processEvents :
qt_plugin_query_metadata :
QEventLoop::exec :
QCoreApplication::exec :
main :
BaseThreadInitThunk :
RtlUserThreadStart :

QGIS Info QGIS Version: 3.28.11-Firenze QGIS code revision: b02458a196 Compiled against Qt: 5.15.3 Running against Qt: 5.15.3 Compiled against GDAL: 3.7.2 Running against GDAL: 3.7.2

System Info CPU Type: x86_64 Kernel Type: winnt Kernel Version: 10.0.19045