Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InvalidSchema in Alvis when trying to get YOLO files for model training in process_classifications.ipynb #448

Open
Bergylta opened this issue Dec 3, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@Bergylta
Copy link
Collaborator

Bergylta commented Dec 3, 2024

🐛 Bug

When trying to obtain the yolo files used for model training using the usual parameters, this error occurs when trying to save the frames.
This is prio 3-4 right now

To Reproduce (REQUIRED)

Input:

# Run the preparation script
mlp.prepare_dataset(
    agg_df=pp.aggregated_zoo_classifications,
    out_path=output_folder.selected,
    img_size=(720, 540),
    perc_test=percentage_test.value,
    out_format="yolo",
    track_frames=True,
)

Output:

WARNING:root:Unable to match species name to metadata. Raw label will be used.
INFO:root:Retrieving movies that are available locally
INFO:root:89 out of 217 movies are available.The missing movies are: [None]
INFO:root:There are 89 movies
100%|██████████| 7/7 [00:00<00:00, 13.51it/s]
Saving frames...:   0%|          | 0/7 [00:00<?, ?it/s]
---------------------------------------------------------------------------
InvalidSchema                             Traceback (most recent call last)
File /usr/src/app/kso-dev/kso_utils/project.py:1431, in MLProjectProcessor.prepare_dataset.<locals>.on_button_clicked(b)
   1429 self.species_of_interest = species_list.value
   1430 # code for prepare dataset for machine learning
-> 1431 self.modules["yolo_utils"].frame_aggregation(
   1432     project=self.project,
   1433     server_connection=self.server_connection,
   1434     db_connection=self.db_connection,
   1435     out_path=out_path,
   1436     perc_test=perc_test,
   1437     class_list=self.species_of_interest,
   1438     img_size=img_size,
   1439     remove_nulls=remove_nulls,
   1440     track_frames=track_frames,
   1441     n_tracked_frames=n_tracked_frames,
   1442     agg_df=agg_df,
   1443     out_format=out_format,
   1444 )

File /usr/src/app/kso-dev/kso_utils/yolo_utils.py:994, in frame_aggregation(project, server_connection, db_connection, out_path, perc_test, class_list, img_size, out_format, remove_nulls, track_frames, n_tracked_frames, agg_df)
    991 else:
    992     if link_bool:
    993         image_output = PIL.Image.open(
--> 994             requests.get(name, stream=True).raw
    995         )
    996     else:
    997         image_output = np.asarray(PIL.Image.open(name))

File /opt/conda/envs/myenv/lib/python3.8/site-packages/requests/api.py:73, in get(url, params, **kwargs)
     62 def get(url, params=None, **kwargs):
     63     r"""Sends a GET request.
     64 
     65     :param url: URL for the new :class:`Request` object.
   (...)
     70     :rtype: requests.Response
     71     """
---> 73     return request("get", url, params=params, **kwargs)

File /opt/conda/envs/myenv/lib/python3.8/site-packages/requests/api.py:59, in request(method, url, **kwargs)
     55 # By using the 'with' statement we are sure the session is closed, thus we
     56 # avoid leaving sockets open which can trigger a ResourceWarning in some
     57 # cases, and look like a memory leak in others.
     58 with sessions.Session() as session:
---> 59     return session.request(method=method, url=url, **kwargs)

File /opt/conda/envs/myenv/lib/python3.8/site-packages/requests/sessions.py:589, in Session.request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)
    584 send_kwargs = {
    585     "timeout": timeout,
    586     "allow_redirects": allow_redirects,
    587 }
    588 send_kwargs.update(settings)
--> 589 resp = self.send(prep, **send_kwargs)
    591 return resp

File /opt/conda/envs/myenv/lib/python3.8/site-packages/requests/sessions.py:697, in Session.send(self, request, **kwargs)
    694 hooks = request.hooks
    696 # Get the appropriate adapter to use
--> 697 adapter = self.get_adapter(url=request.url)
    699 # Start time (approximately) of the request
    700 start = preferred_clock()

File /opt/conda/envs/myenv/lib/python3.8/site-packages/requests/sessions.py:792, in Session.get_adapter(self, url)
    789         return adapter
    791 # Nothing matches :-/
--> 792 raise InvalidSchema(f"No connection adapters were found for {url!r}")

InvalidSchema: No connection adapters were found for "('https://panoptes-uploads.zooniverse.org/subject_location/26653014-efea-4a53-b31b-3f3773271bbd.jpeg',)"

Expected behavior

Environment

If applicable, add screenshots to help explain your problem.

  • OS: [e.g. Ubuntu]
  • GPU [e.g. 2080 Ti]

Additional context

did have to do a change in the filename movies_koster.csv -> movies.csv in db_starter on Alvis in order to get the movie metadata correctly read.

Issue is not present in Cloudina

@Bergylta Bergylta added the bug Something isn't working label Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants