Package: image-annotation-streamlit
Streamlit Image AnnotationStreamlit component for image annotation.FeaturesYou can easily launch an image annotation tool using streamlit.By customizing the pre- and post-processing, you can achieve your preferred annotation workflow.Currently supports classification, detection, point detection tasks.Simple UI that is easy to navigate.Installpipinstallstreamlit-image-annotationExample UsageIf you want to see other use cases, please check inside the examples folder.fromglobimportglobimportpandasaspdimportstreamlitasstfromstreamlit_image_annotationimportclassificationlabel_list=['deer','human','dog','penguin','framingo','teddy bear']image_path_list=glob('image/*.jpg')if'result_df'notinst.session_state:st.session_state['result_df']=pd.DataFrame.from_dict({'image':image_path_list,'label':[0]*len(image_path_list)}).copy()num_page=st.slider('page',0,len(image_path_list)-1,0)label=classification(image_path_list[num_page],label_list=label_list,default_label_index=int(st.session_state['result_df'].loc[num_page,'label']))iflabelisnotNoneandlabel['label']!=st.session_state['result_df'].loc[num_page,'label']:st.session_state['result_df'].loc[num_page,'label']=label_list.index(label['label'])st.table(st.session_state['result_df'])APIclassification(image_path:str,label_list:List[str],default_label_index:Optional[int]=None,height:int=512,width:int=512,key:Optional[str]=None)image_path: Image path.label_list: List of label candidates.default_label_index: Initial label index.height: The maximum height of the displayed image.width: The maximum width of the displayed image.key: An optional string to use as the unique key for the widget. Assign a key so the component is not remount every time the script is rerun.Component Value: {'label': label_name}Example:example codedetection(image_path:str,label_list:List[str],bboxes:Optional[List[List[int,int,int,int]]]=None,labels:Optional[List[int]]=None,height:int=512,width:int=512,line_width:int=5,key:Optional[str]=None)image_path: Image path.label_list: List of label candidates.bboxes: Initial list of bounding boxes, where each bbox is in the format [x, y, w, h].labels: List of label for each initial bbox.height: The maximum height of the displayed image.width: The maximum width of the displayed image.line_width: The stroke width of the bbox.key: An optional string to use as the unique key for the widget. Assign a key so the component is not remount every time the script is rerun.Component Value: [{'bbox':[x,y,width, height], 'label_id': label_id, 'label': label_name},...]Example:example codepointdet(image_path:str,label_list:List[str],points:Optional[List[List[int,int]]]=None,labels:Optional[List[int]]=None,height:int=512,width:int=512,point_width:int=3,key:Optional[str]=None)image_path: Image path.label_list: List of label candidates.points: Initial list of points, where each point is in the format [x, y].labels: List of label for each initial bbox.height: The maximum height of the displayed image.width: The maximum width of the displayed image.point_width: The stroke width of the bbox.key: An optional string to use as the unique key for the widget. Assign a key so the component is not remount every time the script is rerun.Component Value: [{'bbox':[x,y], 'label_id': label_id, 'label': label_name},...]Example:example codeFuture WorkAddition of component for segmentation task.DevelopmentsetupcdStreamlit-Image-Annotation/exportPYTHONPATH=$PWDand setIS_RELEASE = FalseinStreamlit-Image-Annotation/__init__.py.start frontendgitclonehttps://github.com/hirune924/Streamlit-Image-Annotation.gitcdStreamlit-Image-Annotation/streamlit_image_annotation/Detection
yarn
yarnstartstart streamlitcdStreamlit-Image-Annotation/
streamlitrunstreamlit_image_annotation/Detection/__init__.pybuildcdStreamlit-Image-Annotation/Classification/frontend
yarnbuildcdStreamlit-Image-Annotation/Detection/frontend
yarnbuildcdStreamlit-Image-Annotation/Point/frontend
yarnbuildand setIS_RELEASE = TrueinStreamlit-Image-Annotation/__init__.py.make wheelpythonsetup.pysdistbdist_wheeluploadpython3-mtwineupload--repositorytestpypidist/*
python-mpipinstall--index-urlhttps://test.pypi.org/simple/--no-depsstreamlit-image-annotationtwineuploaddist/*image-annotation-streamlit