NameError: name 'AnnotationSet' is not defined
bryceburrows opened this issue · comments
So i did a pip install globox
then in my python...
"
import globox
yolo_preds = AnnotationSet.from_yolo(
folder="D:\AI\mydata\labels",
image_folder="D:\AI\mydata\images")
"
following the demo code...
I then get
Exception has occurred: NameError
name 'AnnotationSet' is not defined
what have i missed?
I just had this issue. AnnotationSet
is defined inside globox. So you can do either
import globox
yolo_preds = globox.AnnotationSet.from_yolo(
folder="D:\AI\mydata\labels",
image_folder="D:\AI\mydata\images")
or
from globox import AnnotationSet
yolo_preds = AnnotationSet.from_yolo(
folder="D:\AI\mydata\labels",
image_folder="D:\AI\mydata\images")
or import all if you will :) from globox import *
This is how Python import statements work and not a Globox issue. @h4pZ summed up the different ways you can import AnnotationSet
. Another solution not mentioned is to import Globox and use a short name like it is usually done with Numpy:
import globox as gx
yolo_preds = gx.AnnotationSet.from_yolo(
folder="D:\AI\mydata\labels",
image_folder="D:\AI\mydata\images",
)
HI, i already tried that and that didn't work.
Thank you for your reply though.
This is how Python import statements work and not a Globox issue. @h4pZ summed up the different ways you can import
AnnotationSet
. Another solution not mentioned is to import Globox and use a short name like it is usually done with Numpy:import globox as gx yolo_preds = gx.AnnotationSet.from_yolo( folder="D:\AI\mydata\labels", image_folder="D:\AI\mydata\images", )
thanks - that seems to work
[edit] actually on one W10 PC - in a Python 3.8.16 conda environment it doesn't work, but on a separate W10 PC in another Python 3.8.16 conda environment it does work....
huh. I need to investigate this further