Error in Classify Image
@john-matroid is already working on this.
Since Mar 28, 2025.
Assessment
This issue has not been assessed yet.
Description
When running the following code:
import json
import os
from matroid.client import Matroid
api = Matroid(client_id='XXX', client_secret='XXX')
folder = "/Users/alex/Downloads/frames"
files = [os.path.join(folder, f) for f in os.listdir(folder)]
# Process files in batches of 5
batch_size = 5
results = []
for i in range(0, len(files), batch_size):
batch = files[i:i + batch_size]
batch_result = api.classify_image(detectorId='67ca12fa78705347cded7b1e', file=batch)
results.extend(batch_result)
with open("results.json", "w") as f:
json.dump(results, f, indent=4)
I had this error:
Traceback (most recent call last):
File "/Users/alex/temp1/temp/lib/python3.13/site-packages/matroid/src/images.py", line 36, in classify_image
return batch_file_request(file, method, endpoint, headers, data)
File "/Users/alex/temp1/temp/lib/python3.13/site-packages/matroid/src/helpers.py", line 116, in batch_file_request
% (bytes_to_mb(MAX_LOCAL_IMAGE_BATCH_SIZE))
~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: bytes_to_mb() missing 1 required positional argument: 'bytes'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/alex/temp1/get_annotations.py", line 15, in <module>
batch_result = api.classify_image(detectorId='67ca12fa78705347cded7b1e', file=batch)
File "/Users/alex/temp1/temp/lib/python3.13/site-packages/matroid/src/helpers.py", line 18, in setup_and_teardown
response = func(self, *original_args, **original_kwargs)
File "/Users/alex/temp1/temp/lib/python3.13/site-packages/matroid/src/images.py", line 46, in classify_image
raise error.APIConnectionError(message=e)
matroid.error.APIConnectionError: bytes_to_mb() missing 1 required positional argument: 'bytes'
- Dominant language
- Python
- Stars
- 18
- Forks
- 5
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from matroid/matroid-python
-
bug
matroid/matroid-python#20 · 1 comment · 1 assignee ·
All issues in matroid/matroid-python
Similar issues
-
Add: hunch Open
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
AbdelStark/awesome-typesafe#104 ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
DiamondLightSource/dodal#2211 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
openml/openml-python#1749 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
sipyourdrink-ltd/bernstein#6191 ·