kwcoco.cli.coco_plot_stats module¶
CommandLine
xdoctest -m kwcoco.cli.coco_plot_stats __doc__:0
xdoctest -m kwcoco.cli.coco_plot_stats __doc__:1
Example
>>> # xdoctest: +REQUIRES(module:kwutil)
>>> # Stats on a simple dataset
>>> from kwcoco.cli.coco_plot_stats import * # NOQA
>>> import kwcoco
>>> dpath = ub.Path.appdir('kwcoco/tests/vis_stats').ensuredir()
>>> coco_fpath = kwcoco.CocoDataset.demo('vidshapes8').fpath
>>> cmdline = 0
>>> kwargs = dict(src=coco_fpath, dst_dpath=dpath)
>>> cls = PlotStatsCLI
>>> cls.main(cmdline=cmdline, **kwargs)
Example
>>> # xdoctest: +REQUIRES(module:kwutil)
>>> # Stats on a more complex dataset
>>> from kwcoco.cli.coco_plot_stats import * # NOQA
>>> import kwcoco
>>> import kwarray.distributions
>>> import kwarray
>>> rng = kwarray.ensure_rng(0)
>>> dpath = ub.Path.appdir('kwcoco/tests/vis_stats2').ensuredir()
>>> dset = kwcoco.CocoDataset.demo('vidshapes8', image_size='random',
>>> timestamps=True, rng=rng)
>>> coco_fpath = dset.fpath
>>> cmdline = 0
>>> kwargs = dict(src=coco_fpath, dst_dpath=dpath)
>>> cls = PlotStatsCLI
>>> cls.main(cmdline=cmdline, **kwargs)
- class kwcoco.cli.coco_plot_stats.PlotStatsCLI(*args, **kwargs)[source]¶
Bases:
DataConfigInspect properties of dataset and write raw data tables and visual plots.
Valid options: []
- Parameters:
*args – positional arguments for this data config
**kwargs – keyword arguments for this data config
- default = {'dpi': <Value(300)>, 'dst_dpath': <Value('./coco_annot_stats')>, 'dst_fpath': <Value('auto')>, 'options': <Value(None)>, 'plots': <Value(None)>, 'src': <Value(None)>, 'with_process_context': <Value(True)>}¶
- kwcoco.cli.coco_plot_stats.rerun_plots(tables_fpath)[source]¶
Todo
[ ] Easy CLI / IPython mechanism to rerun plots with precompiled stat tables
from kwcoco.cli.coco_plot_stats import * # NOQA tables_fpath = ‘./coco_annot_stats2/stats_tables.json’ import kwplot import kwplot kwplot.autosns()
- kwcoco.cli.coco_plot_stats.build_stats_data(dset)[source]¶
Build a table of perimage and perannotation as well as a summary table of higher level results.
- class kwcoco.cli.coco_plot_stats.Plots(plots_dpath, tables_data, nonsaved_data, options=None, dpi=300)[source]¶
Bases:
objectDefines plot functions as a class, to make it easier to share common data and write the functions in a more concise manner. This also makes it easier to enable / disable plots.
- _plot_function_registery = {}¶
- class kwcoco.cli.coco_plot_stats.BuiltinPlots[source]¶
Bases:
objectA class that ONLY contains methods that will produce a plot. This is used to register them with
Plots.Note
The “self” argument is an instance of Plots, not this class. It would be nice to find a better way to organize this.
- polygon_centroid_absolute_distribution()[source]¶
Example
>>> # xdoctest: +REQUIRES(module:kwutil) >>> from kwcoco.cli.coco_plot_stats import * # NOQA >>> self = Plots.demo() >>> self['polygon_centroid_absolute_distribution'](self)
- polygon_centroid_relative_distribution()[source]¶
Example
>>> # xdoctest: +REQUIRES(module:kwutil) >>> from kwcoco.cli.coco_plot_stats import * # NOQA >>> self = Plots.demo() >>> self['polygon_centroid_relative_distribution'](self)
- polygon_centroid_absolute_distribution_jointplot()[source]¶
Example
>>> # xdoctest: +REQUIRES(module:kwutil) >>> from kwcoco.cli.coco_plot_stats import * # NOQA >>> self = Plots.demo(timestamps=True) >>> self['polygon_centroid_absolute_distribution_jointplot'](self)
- polygon_centroid_relative_distribution_jointplot()[source]¶
Example
>>> # xdoctest: +REQUIRES(module:kwutil) >>> from kwcoco.cli.coco_plot_stats import * # NOQA >>> self = Plots.demo(timestamps=True) >>> self['polygon_centroid_relative_distribution_jointplot'](self)
- image_size_histogram()[source]¶
Example
>>> # xdoctest: +REQUIRES(module:kwutil) >>> from kwcoco.cli.coco_plot_stats import * # NOQA >>> self = Plots.demo(timestamps=True, image_size='random', num_frames=100) >>> self['image_size_histogram'](self)
- image_size_scatter()[source]¶
Example
>>> # xdoctest: +REQUIRES(module:kwutil) >>> from kwcoco.cli.coco_plot_stats import * # NOQA >>> self = Plots.demo(timestamps=True, image_size='random', num_frames=100) >>> self['image_size_scatter'](self)
- obox_size_distribution()[source]¶
Example
>>> # xdoctest: +REQUIRES(module:kwutil) >>> from kwcoco.cli.coco_plot_stats import * # NOQA >>> self = Plots.demo() >>> self['obox_size_distribution'](self)
- obox_size_distribution_jointplot()[source]¶
Example
>>> # xdoctest: +REQUIRES(module:kwutil) >>> from kwcoco.cli.coco_plot_stats import * # NOQA >>> self = Plots.demo() >>> self['obox_size_distribution_jointplot'](self)
- obox_size_distribution_logscale()[source]¶
Example
>>> # xdoctest: +REQUIRES(module:kwutil) >>> from kwcoco.cli.coco_plot_stats import * # NOQA >>> self = Plots.demo() >>> self['obox_size_distribution_logscale'](self)
- polygon_area_vs_num_verts()[source]¶
Example
>>> # xdoctest: +REQUIRES(module:kwutil) >>> from kwcoco.cli.coco_plot_stats import * # NOQA >>> self = Plots.demo() >>> self['polygon_area_vs_num_verts'](self)
- polygon_area_vs_num_verts_jointplot()[source]¶
Example
>>> # xdoctest: +REQUIRES(module:kwutil) >>> from kwcoco.cli.coco_plot_stats import * # NOQA >>> self = Plots.demo() >>> self['polygon_area_vs_num_verts_jointplot'](self)
- polygon_area_vs_num_verts_jointplot_logscale()[source]¶
Example
>>> # xdoctest: +REQUIRES(module:kwutil) >>> from kwcoco.cli.coco_plot_stats import * # NOQA >>> self = Plots.demo(timestamps=True) >>> self['polygon_area_vs_num_verts_jointplot_logscale'](self)
- polygon_area_histogram_logscale()[source]¶
Example
>>> # xdoctest: +REQUIRES(module:kwutil) >>> from kwcoco.cli.coco_plot_stats import * # NOQA >>> self = Plots.demo() >>> self['polygon_area_histogram_logscale'](self)
- polygon_area_histogram()[source]¶
Example
>>> # xdoctest: +REQUIRES(module:kwutil) >>> from kwcoco.cli.coco_plot_stats import * # NOQA >>> self = Plots.demo() >>> self['polygon_area_histogram'](self)
- polygon_area_histogram_splity()[source]¶
Example
>>> # xdoctest: +REQUIRES(module:kwutil) >>> from kwcoco.cli.coco_plot_stats import * # NOQA >>> self = Plots.demo() >>> self['polygon_area_histogram_splity'](self)
- polygon_num_vertices_histogram()[source]¶
Example
>>> # xdoctest: +REQUIRES(module:kwutil) >>> from kwcoco.cli.coco_plot_stats import * # NOQA >>> self = Plots.demo() >>> self['polygon_num_vertices_histogram'](self)
- anns_per_image_histogram()[source]¶
Example
>>> # xdoctest: +REQUIRES(module:kwutil) >>> from kwcoco.cli.coco_plot_stats import * # NOQA >>> self = Plots.demo() >>> self['anns_per_image_histogram'](self)
- anns_per_image_histogram_splity()[source]¶
Example
>>> # xdoctest: +REQUIRES(module:kwutil) >>> from kwcoco.cli.coco_plot_stats import * # NOQA >>> self = Plots.demo() >>> self['anns_per_image_histogram_splity'](self)
- anns_per_image_histogram_ge1()[source]¶
Example
>>> # xdoctest: +REQUIRES(module:kwutil) >>> from kwcoco.cli.coco_plot_stats import * # NOQA >>> self = Plots.demo() >>> self['anns_per_image_histogram_ge1'](self)
- images_over_time()[source]¶
Example
>>> # xdoctest: +REQUIRES(module:kwutil) >>> from kwcoco.cli.coco_plot_stats import * # NOQA >>> self = Plots.demo(timestamps=True) >>> self['images_over_time'](self)
- kwcoco.cli.coco_plot_stats.polygon_shape_stats(df)[source]¶
Compute shape statistics about a geopandas dataframe (assume UTM CRS)
Todo
[ ] Use geopandas if available, but fallback to non-geopandas logic