Skip to content

"Tensor data is null. Run allocate_tensors() first" when running on Arch Linux #19

Description

@max-mapper

Hi, I am trying to run the bat_ident.py on Arch Linux. I did the following:

git clone https://github.com/rdz-oss/BattyBirdNET-Analyze
cd BattyBirdNET-Analyze
docker build . -t batty
docker run -v ~/bats:/home/bats -it batty bat_ident.py --area USA --i /home/bats/ --o /home/bats/out/ --rtype csv

But it printed e.g. Error: Cannot analyze audio file /home/bats/NoID_20240726_211812.wav.. After patching

cfg.ERROR_LOG_FILE = os.path.join(script_dir, cfg.ERROR_LOG_FILE)
to /home/bats/error.log I could see the full error:

Traceback (most recent call last):
  File "//bat_ident.py", line 281, in analyze_file
    prediction = predict(samples)
  File "//bat_ident.py", line 217, in predict
    prediction = model.predict(data)
  File "/model.py", line 308, in predict
    return predictWithCustomClassifier(sample)
  File "/model.py", line 351, in predictWithCustomClassifier
    feature_vector = embeddings(sample)
  File "/model.py", line 387, in embeddings
    features = INTERPRETER.get_tensor(OUTPUT_LAYER_INDEX)
  File "/usr/local/lib/python3.9/site-packages/tensorflow/lite/python/interpreter.py", line 888, in get_tensor
    return self._interpreter.GetTensor(tensor_index, subgraph_index)
ValueError: Tensor data is null. Run allocate_tensors() first

I can see in the code that allocate_tensors() is always run after tflite.Interpreter() calls so I'm not sure whats going on, maybe a version mismatch from the known working version (since the dockerfile installs the latest of everything)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions