vale46n1 / immich_duplicate_finder

A Comprehensive Solution for Identifying and Managing Duplicate Photos in Immich
Apache License 2.0
228 stars 19 forks source link

RuntimeError: The size of tensor a (4) must match the size of tensor b (3) at non-singleton dimension 0 #44

Open BoBBer446 opened 6 months ago

BoBBer446 commented 6 months ago

While Create/Update FAISS index i get this one:

RuntimeError: The size of tensor a (4) must match the size of tensor b (3) at non-singleton dimension 0
Traceback:
File "/usr/local/lib/python3.12/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 542, in _run_script
    exec(code, module.__dict__)
File "/immich_duplicate_finder/app.py", line 130, in <module>
    main()
File "/immich_duplicate_finder/app.py", line 109, in main
    calculateFaissIndex(
File "/immich_duplicate_finder/imageDuplicate.py", line 117, in calculateFaissIndex
    status = update_faiss_index(immich_server_url,api_key, asset_id)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/immich_duplicate_finder/imageDuplicate.py", line 68, in update_faiss_index
    features = extract_features(image)
               ^^^^^^^^^^^^^^^^^^^^^^^
File "/immich_duplicate_finder/imageDuplicate.py", line 35, in extract_features
    image_tensor = transform(image).unsqueeze(0)  # Add batch dimension
                   ^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/torchvision/transforms/transforms.py", line 95, in __call__
    img = t(img)
          ^^^^^^
File "/usr/local/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1511, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1520, in _call_impl
    return forward_call(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/torchvision/transforms/transforms.py", line 277, in forward
    return F.normalize(tensor, self.mean, self.std, self.inplace)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/torchvision/transforms/functional.py", line 349, in normalize
    return F_t.normalize(tensor, mean=mean, std=std, inplace=inplace)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/torchvision/transforms/_functional_tensor.py", line 926, in normalize
    return tensor.sub_(mean).div_(std)
           ^^^^^^^^^^^^^^^^^

Version: v0.1.3, Docker Compose

Immich Server Version: v1.105.v1.105.v1.105.

image

Fclem commented 6 months ago

Duplicate of https://github.com/vale46n1/immich_duplicate_finder/issues/32 . Please check open issues before posting.