I noted on the python- sdk for the custom vision, I can only create new project and create new tag. Is there a way to use existing project and existing tag?
like changing the code: bus_stop_tag = trainer.create_tag(project_id, "")
project = trainer.create_project("Android App for Bus_Stop_Detection", domain_id=obj_detection_domain.id)?
⚠Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
@ericjiang18 , Could you please provide the document you are referring to?
@DashleenBhandari-MSFT
the link is here: https://docs.microsoft.com/en-us/azure/cognitive-services/custom-vision-service/python-tutorial-od
Thank you so much for helping :)
There are two ways to use existing projects or tags:
trainer.create_tag("d6bef13c-f3cb-4784-9396-8cbf7f44acab", "my new tag")
project = next(filter(lambda p: p.name == "Android App for Bus_Stop_Detection", trainer.get_projects()), None)
if not project:
print ("Couldn't find project")
exit(-1)
bus_stop_tag = next(filter(lambda t: t.name == "bus stop", trainer.get_tags(project.id)), None)
if not bus_stop_tag:
print ("Couldn't find tag")
exit(-1)
ok got it! thanks
@ericjiang18 We will now proceed to close this thread. If there are further questions regarding this matter, please tag me in your reply. We will gladly continue the discussion and we will reopen the issue.
I ran into error somehow
File "Training.py", line 39, in
bus_stop_tag = next(filter(lambda t: t.name == "postive", trainer.get_tags()), None)
TypeError: get_tags() missing 1 required positional argument: 'project_id'
@ram-msft
@ericjiang18 Sorry, I missed the arg in the snippet, will edit but it should be:
bus_stop_tag = next(filter(lambda t: t.name == "bus stop", trainer.get_tags(project.id)), None)
@areddish
I somehow got this error:
AttributeError: 'NoneType' object has no attribute 'id'
That’s the error you’d get if you don’t have project set to a valid project object.
@areddish i am pretty sure I have the project object, but still shows error
@areddish how can i set it?
@ericjiang18 Use the snipped above to set both, updated it and repasted here:
project = next(filter(lambda p: p.name == "Android App for Bus_Stop_Detection", trainer.get_projects()), None)
if not project:
print ("Couldn't find project")
exit(-1)
bus_stop_tag = next(filter(lambda t: t.name == "bus stop", trainer.get_tags(project.id)), None)
if not bus_stop_tag:
print ("Couldn't find tag")
exit(-1)
Most helpful comment
There are two ways to use existing projects or tags: