diff --git a/docs/installation.md b/docs/installation.md index 45fc2879..a83e324d 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -3,7 +3,7 @@ DeepForest has Windows, Linux and OSX prebuilt wheels on pypi. We *strongly* recommend using a conda or virtualenv to create a clean installation container. ``` -pip install DeepForest-pytorch +pip install DeepForest ``` For questions on conda-forge installation, please submit issues to the feedstock repo: https://github.com/conda-forge/deepforest-feedstock diff --git a/project.wpr b/project.wpr index 0bf9082d..a6037306 100644 --- a/project.wpr +++ b/project.wpr @@ -4,6 +4,22 @@ # Wing project file # ################################################################## [project attributes] +debug.launch-configs = (2, + {'launch-csXdSw9d1tIxroc9': ({}, + {'buildcmd': ('project', + None), + 'env': ('project', + [u'']), + 'name': 'pip', + 'pyexec': ('custom', + u'/Users/benweinstein/opt/miniconda3/envs/test/bin/python'), + 'pypath': ('project', + []), + 'pyrunargs': ('project', + '-u'), + 'runargs': u'', + 'rundir': ('project', + u'')})}) proj.directory-list = [{'dirloc': loc('.'), 'excludes': (), 'filter': u'*', @@ -11,6 +27,9 @@ proj.directory-list = [{'dirloc': loc('.'), 'recursive': True, 'watch_for_changes': True}] proj.file-type = 'shared' +proj.launch-config = {loc('tests/test_main.py'): ('custom', + (u'', + 'launch-csXdSw9d1tIxroc9'))} testing.auto-test-file-specs = (('glob', 'test_*'),) testing.test-framework = {None: ':internal pytest'} diff --git a/project.wpu b/project.wpu index 7fc436df..fed39a19 100644 --- a/project.wpu +++ b/project.wpu @@ -9,15 +9,7 @@ codewarnings.hide-directive-list = [('warning.1.variable-not-used', 'big_file|0|', 'image_path', None)] -debug.breakpoints = {loc('deepforest/main.py'): {437L: (0, - None, - 1, - 0)}, - loc('deepforest/predict.py'): {106L: (0, - None, - 1, - 0)}, - loc('sandbox.py'): {8L: (0, +debug.breakpoints = {loc('sandbox.py'): {8L: (0, None, 1, 0)}, @@ -44,7 +36,8 @@ debug.err-values = {loc('../../../../Applications/WingPro.app/Contents/Resources 0, None)}} debug.exceptions-ignored = {loc('../../opt/miniconda3/envs/DeepForest/lib/python3.7/site-packages/_pytest/config/__init__.py'): {1514: True}, - loc('../../opt/miniconda3/envs/DeepForest_pytorch/lib/python3.8/site-packages/_pytest/config/__init__.py'): {1514: True}} + loc('../../opt/miniconda3/envs/DeepForest_pytorch/lib/python3.8/site-packages/_pytest/config/__init__.py'): {1514: True}, + loc('../../opt/miniconda3/envs/test/lib/python3.7/site-packages/_pytest/config/__init__.py'): {1514: True}} debug.remote-hosts = (9, [{'activate-cmd': '', 'agent-port': 0, @@ -81,11 +74,9 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window', {'tree-state': {'file-sort-method': 'by name', 'list-files-first': False, 'tree-states': {'deep': {'expanded-nodes': [(1,), - (2,), (20,)], - 'selected-nodes': [(1, - 9)], - 'top-node': (0,)}}, + 'selected-nodes': [(11,)], + 'top-node': (4,)}}, 'tree-style': 'deep'}}), ('browser', 'tall', @@ -189,15 +180,14 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window', 'filter': u'', 'recent-filters': None, 'sort-order': 'source-lineno', - 'tree-state': {'expanded-nodes': [(6,), + 'tree-state': {'expanded-nodes': [(5,), + (6,), (6, - 1), - (6, - 1, - 0)], + 16)], 'selected-nodes': [(6, - 1)], - 'top-node': (4,)}}), + 16)], + 'top-node': (6, + 1)}}), ('debug-io', 'wide', 1, @@ -214,22 +204,10 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window', -1), 'attrib-starts': [], 'code-line': '', - 'first-line': 1532L, + 'first-line': 1626L, 'folded-linenos': [], 'history': {u'file:/Applications/WingPro.app/Contents/Resources/src/testing/runners/run_pytest_xml.py': ['p'\ - 'arams["bboxes"][index:,]\n', - 'x, y, x2, y2 = union_of_bboxes(\n width=img_w, height=img_h, bbo'\ - 'xes=params["bboxes"][index,:], erosion_rate=self.erosion_rate\n)\n'\ - '\n', - 'bbox[:4]\n', - 'bbox\n', - 'self.n = 2\n', - 'index = np.random.choice(len(params["bboxes"]), self.n, replace=Fal'\ - 'se)[0]\n', - 'index = np.random.choice(len(params["bboxes"]), self.n, replace=Fal'\ - 'se)\n', - 'params["bboxes"][index,:]\n', - 'params["bboxes"][index,:].shape\n', + 'arams["bboxes"][index,:].shape\n', 'params["bboxes"][1,:].shape\n', 'selected_boxes\n', ' augmented_image\n', @@ -402,12 +380,30 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window', 'boxes\n', 'boxes = m.predict_image(path=imgpath, return_plot=True)\n', 'from matplotlib import pyplot\n', - 'pyplot.imshow(boxes)\n']}, + 'pyplot.imshow(boxes)\n', + 'if not results["results"].empty: \n results["results"]["predicte'\ + 'd_label"] = results["results"]["predicted_label"].apply(lambda x: s'\ + 'elf.numeric_to_label_dict[x] if not pd.isnull(x) else x)\n resul'\ + 'ts["results"]["true_label"] = results["results"]["true_label"].appl'\ + 'y(lambda x: self.numeric_to_label_dict[x])\n\n', + 'assert results["results"].predicted_label.unique() == ["Tree"]\n', + 'results\n', + 'results["results"].predicted_label\n', + 'results["results"]\n', + 'results["results"].predicted_label.unique()\n', + 'assert len(results["results"].predicted_label.notnull.unique()) == '\ + '1\n', + 'assert len(results["results"].predicted_label.notnull().unique()) ='\ + '= 1\n', + 'results["results"].predicted_label.notnull().unique()\n', + 'assert len(results["results"].predicted_label.dropna().unique()) =='\ + ' 1\n', + 'results["box_recall"]\n']}, 'launch-id': None, - 'sel-line': 1552L, - 'sel-line-start': 473012L, - 'selection_end': 473012L, - 'selection_start': 473012L, + 'sel-line': 1646L, + 'sel-line-start': 477481L, + 'selection_end': 477481L, + 'selection_start': 477481L, 'zoom': 0L}), ('debug-watch', 'wide', @@ -427,7 +423,7 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window', -1, -1), 'attrib-starts': [], - 'code-line': '', + 'code-line': 'array([0.25, 0.5 , 0.75, 1. ])\n', 'first-line': 0L, 'folded-linenos': [], 'history': {None: ['from albumentations import functi'\ @@ -467,12 +463,14 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window', 'm.use_bird_detector()\n', 'from deepforest import main\n', 'm = main.deepforest()\n', - 'm.use_bird_release()\n']}, + 'm.use_bird_release()\n', + 'import numpy as np\n', + 'np.arange(0.25,1.25,0.25)\n']}, 'launch-id': None, - 'sel-line': 3L, - 'sel-line-start': 162L, - 'selection_end': 162L, - 'selection_start': 162L, + 'sel-line': 5L, + 'sel-line-start': 207L, + 'selection_end': 230L, + 'selection_start': 230L, 'zoom': 0L}), ('bookmarks', 'wide', @@ -486,274 +484,286 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window', 'wide', 1, {})], - 'primary_view_state': {'editor_states': ({'bookmarks': ([[loc('tests/test_visualize.py'), - {'attrib-starts': [('test_plot_predictions|0|', - 35)], - 'code-line': 'def test_plot_predictions(m, tmpdir,label):\n', - 'first-line': 23L, + 'primary_view_state': {'editor_states': ({'bookmarks': ([[loc('docs/getting_started.md'), + {'attrib-starts': [], + 'code-line': '\n', + 'first-line': 0L, 'folded-linenos': [], - 'sel-line': 35L, - 'sel-line-start': 1071L, - 'selection_end': 1101L, - 'selection_start': 1101L, + 'sel-line': 48L, + 'sel-line-start': 2808L, + 'selection_end': 2808L, + 'selection_start': 2808L, 'zoom': 0L}, - 1622515822.623015], - [loc('../BirdDetector/generalization.py'), - {'attrib-starts': [('train|0|', - 452)], - 'code-line': ' saved_model = main.deepforest.load_from_checkpoi'\ - 'nt("/orange/ewhite/b.weinstein/AerialDetection/snaps'\ - 'hots/20210530_233702/DOTA.pl")\n', - 'first-line': 471L, + 1622744475.258699], + [loc('docs/installation.md'), + {'attrib-starts': [], + 'code-line': '\n', + 'first-line': 28L, 'folded-linenos': [], - 'sel-line': 486L, - 'sel-line-start': 22496L, - 'selection_end': 22496L, - 'selection_start': 22496L, + 'sel-line': 3L, + 'sel-line-start': 173L, + 'selection_end': 173L, + 'selection_start': 173L, 'zoom': 0L}, - 1622515822.626008], - [loc('../BirdDetector/utils/DOTA_pretraining.py'), + 1622744510.461698], + [loc('azure-pipelines.yml'), {'attrib-starts': [], - 'code-line': 'n_classes = len(train_df.label.unique())\n', - 'first-line': 67L, + 'code-line': ' - refs/tags/*\n', + 'first-line': 0L, 'folded-linenos': [], - 'sel-line': 80L, - 'sel-line-start': 3141L, - 'selection_end': 3181L, - 'selection_start': 3181L, + 'sel-line': 12L, + 'sel-line-start': 351L, + 'selection_end': 368L, + 'selection_start': 368L, 'zoom': 0L}, - 1622515822.628605], - [loc('deepforest/main.py'), - {'attrib-starts': [('deepforest|0|', - 20), - ('deepforest|0|.__init__|0|', - 24)], - 'code-line': ' self.create_model()\n', - 'first-line': 53L, + 1622745978.824584], + [loc('setup.py'), + {'attrib-starts': [], + 'code-line': "VERSION = '0.2.4'\n", + 'first-line': 0L, 'folded-linenos': [], - 'sel-line': 58L, - 'sel-line-start': 1956L, - 'selection_end': 1984L, - 'selection_start': 1956L, + 'sel-line': 5L, + 'sel-line-start': 154L, + 'selection_end': 164L, + 'selection_start': 164L, 'zoom': 0L}, - 1622515920.187314], - [loc('tests/test_main.py'), - {'attrib-starts': [('test_reload_multi_class|0|', - 232)], - 'code-line': ' main.deepforest.load_from_checkpoint("{}/checkpo'\ - 'int.pl".format(tmpdir))\n', - 'first-line': 226L, + 1622745994.038944], + [loc('setup.cfg'), + {'attrib-starts': [], + 'code-line': '[bumpversion]\n', + 'first-line': 0L, 'folded-linenos': [], - 'sel-line': 237L, - 'sel-line-start': 8617L, - 'selection_end': 8692L, - 'selection_start': 8617L, + 'sel-line': 0L, + 'sel-line-start': 0L, + 'selection_end': 0L, + 'selection_start': 0L, 'zoom': 0L}, - 1622515920.209853], - [loc('tests/test_main.py'), - {'attrib-starts': [('test_reload_multi_class|0|', - 232)], - 'code-line': ' loaded.model.load_state_dict(old_model["state_di'\ - 'ct"])\n', - 'first-line': 223L, + 1622746018.023372], + [loc('deepforest/__init__.py'), + {'attrib-starts': [], + 'code-line': '\n', + 'first-line': 0L, 'folded-linenos': [], - 'sel-line': 239L, - 'sel-line-start': 8756L, - 'selection_end': 8813L, - 'selection_start': 8813L, + 'sel-line': 5L, + 'sel-line-start': 161L, + 'selection_end': 161L, + 'selection_start': 161L, 'zoom': 0L}, - 1622516108.762496], - [loc('tests/test_main.py'), - {'attrib-starts': [('test_reload_multi_class|0|', - 232)], - 'code-line': ' old_model = torch.load("{}/checkpoint.pl".format'\ - '(tmpdir))\n', - 'first-line': 228L, + 1622746125.167785], + [loc('azure-pipelines.yml'), + {'attrib-starts': [], + 'code-line': ' pip install .\n', + 'first-line': 13L, 'folded-linenos': [], - 'sel-line': 238L, - 'sel-line-start': 8694L, - 'selection_end': 8755L, - 'selection_start': 8698L, + 'sel-line': 28L, + 'sel-line-start': 628L, + 'selection_end': 647L, + 'selection_start': 647L, 'zoom': 0L}, - 1622516156.600984], + 1622746817.311969], [loc('../BirdDetector/generalization.py'), - {'attrib-starts': [('train|0|', - 452)], - 'code-line': ' main.deepforest(num_classes=13, label_dict=)\n', - 'first-line': 471L, + {'attrib-starts': [('prepare_USGS|0|', + 400)], + 'code-line': ' patch_size=1200,\n', + 'first-line': 408L, 'folded-linenos': [], - 'sel-line': 487L, - 'sel-line-start': 22639L, - 'selection_end': 22686L, - 'selection_start': 22686L, + 'sel-line': 413L, + 'sel-line-start': 19287L, + 'selection_end': 19314L, + 'selection_start': 19314L, 'zoom': 0L}, - 1622516794.491231], - [loc('../BirdDetector/utils/DOTA_pretraining.py'), + 1622747076.504979], + [loc('dev_requirements.txt'), {'attrib-starts': [], - 'code-line': 'm = main.deepforest(num_classes= n_classes, label_d'\ - 'ict=label_dict)\n', - 'first-line': 70L, + 'code-line': 'sphinx_markdown_tables\n', + 'first-line': 0L, 'folded-linenos': [], - 'sel-line': 81L, - 'sel-line-start': 3182L, - 'selection_end': 3232L, - 'selection_start': 3227L, + 'sel-line': 20L, + 'sel-line-start': 196L, + 'selection_end': 218L, + 'selection_start': 218L, 'zoom': 0L}, - 1622516798.417303], - [loc('../BirdDetector/utils/DOTA_pretraining.py'), - {'attrib-starts': [], - 'code-line': 'label_dict = {x: index for index, x in enumerate(tra'\ - 'in_df.label.unique())}\n', - 'first-line': 70L, + 1622747110.413571], + [loc('tests/test_main.py'), + {'attrib-starts': [('test_main|0|', + 78)], + 'code-line': ' from deepforest import main\n', + 'first-line': 69L, 'folded-linenos': [], 'sel-line': 79L, - 'sel-line-start': 3066L, - 'selection_end': 3141L, - 'selection_start': 3066L, - 'zoom': 0L}, - 1622516807.859023], - [loc('../BirdDetector/generalization.py'), - {'attrib-starts': [('train|0|', - 452)], - 'code-line': " train_df = pd.read_csv(filepath_or_buffer, sep=l"\ - "ib.no_default, delimiter=None, header=\"infer\", nam"\ - "es=None, index_col=None, usecols=None, squeeze=False"\ - ", prefix=None, mangle_dupe_cols=True, dtype=None, en"\ - "gine=None, converters=None, true_values=None, false_"\ - "values=None, skipinitialspace=False, skiprows=None, "\ - "skipfooter=0, nrows=None, na_values=None, keep_defau"\ - "lt_na=True, na_filter=True, verbose=False, skip_blan"\ - "k_lines=True, parse_dates=False, infer_datetime_form"\ - "at=False, keep_date_col=False, date_parser=None, day"\ - "first=False, cache_dates=True, iterator=False, chunk"\ - "size=None, compression=\"infer\", thousands=None, de"\ - "cimal=\".\", lineterminator=None, quotechar='\"', qu"\ - "oting=csv.QUOTE_MINIMAL, doublequote=True, escapecha"\ - "r=None, comment=None, encoding=None, dialect=None, e"\ - "rror_bad_lines=True, warn_bad_lines=True, delim_whit"\ - "espace=False, low_memory=_c_parser_defaults[\"low_me"\ - "mory\"], memory_map=False, float_precision=None, sto"\ - "rage_options=None)\n", - 'first-line': 477L, - 'folded-linenos': [], - 'sel-line': 487L, - 'sel-line-start': 22639L, - 'selection_end': 23583L, - 'selection_start': 22666L, + 'sel-line-start': 2359L, + 'selection_end': 2390L, + 'selection_start': 2390L, 'zoom': 0L}, - 1622516829.40239], - [loc('../BirdDetector/utils/DOTA_pretraining.py'), - {'attrib-starts': [('prepare|0|', - 17)], - 'code-line': ' train = pd.read_csv("/orange/ewhite/b.weinst'\ - 'ein/AerialDetection/data/trainval1024/train.csv")\n', - 'first-line': 32L, + 1622747110.436167], + [loc('tests/test_main.py'), + {'attrib-starts': [('test_evaluate|0|', + 186)], + 'code-line': ' assert np.round(results["box_recall"],2) > 0.5\n', + 'first-line': 178L, 'folded-linenos': [], - 'sel-line': 44L, - 'sel-line-start': 1925L, - 'selection_end': 2026L, - 'selection_start': 1940L, + 'sel-line': 194L, + 'sel-line-start': 6980L, + 'selection_end': 7030L, + 'selection_start': 7030L, 'zoom': 0L}, - 1622516839.534063], + 1622748116.887637], [loc('../BirdDetector/generalization.py'), - {'attrib-starts': [], - 'code-line': ' train_sets = ["terns","palmyra","penguins","pfei'\ - 'fer","hayes","everglades"]\n', - 'first-line': 571L, + {'attrib-starts': [('prepare_USGS|0|', + 400)], + 'code-line': ' patch_size=1200,\n', + 'first-line': 408L, 'folded-linenos': [], - 'sel-line': 581L, - 'sel-line-start': 27055L, - 'selection_end': 27069L, - 'selection_start': 27069L, + 'sel-line': 413L, + 'sel-line-start': 19287L, + 'selection_end': 19314L, + 'selection_start': 19314L, 'zoom': 0L}, - 1622656121.465528], - [loc('docs/getting_started.md'), - {'attrib-starts': [], - 'code-line': '\n', - 'first-line': 35L, + 1622750513.705418], + [loc('tests/test_main.py'), + {'attrib-starts': [('test_evaluate|0|', + 186)], + 'code-line': ' assert np.round(results["box_recall"],2) > 0.5\n', + 'first-line': 178L, 'folded-linenos': [], - 'sel-line': 48L, - 'sel-line-start': 2808L, - 'selection_end': 2808L, - 'selection_start': 2808L, + 'sel-line': 194L, + 'sel-line-start': 6980L, + 'selection_end': 7030L, + 'selection_start': 7030L, 'zoom': 0L}, - 1622656163.984233], - [loc('../DeepForest/docs/landing.md'), + 1622750513.715766], + [loc('tests/test_main.py'), {'attrib-starts': [], - 'code-line': '# What is DeepForest?\n', - 'first-line': 3L, + 'code-line': '#test main\n', + 'first-line': 0L, 'folded-linenos': [], 'sel-line': 0L, 'sel-line-start': 0L, - 'selection_end': 0L, + 'selection_end': 10L, 'selection_start': 0L, 'zoom': 0L}, - 1622657453.314934], - [loc('deepforest/main.py'), - {'attrib-starts': [], - 'code-line': 'from deepforest import model\n', - 'first-line': 308L, + 1622750516.838037], + [loc('tests/test_main.py'), + {'attrib-starts': [('test_evaluate|0|', + 186)], + 'code-line': ' assert results["results"].predicted_label.unique'\ + '() == ["Tree"]\n', + 'first-line': 174L, 'folded-linenos': [], - 'sel-line': 14L, - 'sel-line-start': 290L, - 'selection_end': 318L, - 'selection_start': 318L, + 'sel-line': 195L, + 'sel-line-start': 7031L, + 'selection_end': 7063L, + 'selection_start': 7063L, 'zoom': 0L}, - 1622668572.470626], - [loc('deepforest/utilities.py'), - {'attrib-starts': [('use_release|0|', - 101)], - 'code-line': " headers={'Accept': 'application/vnd."\ - "github.v3+json'},\n", - 'first-line': 83L, + 1622750546.430025], + [loc('deepforest/predict.py'), + {'attrib-starts': [('predict_file|0|', + 63)], + 'code-line': ' image = np.array(Image.open("{}/{}".form'\ + 'at(root_dir,paths[index])))[:,:,::-1]\n', + 'first-line': 86L, 'folded-linenos': [], - 'sel-line': 116L, - 'sel-line-start': 3961L, - 'selection_end': 3991L, - 'selection_start': 3991L, + 'sel-line': 105L, + 'sel-line-start': 4014L, + 'selection_end': 4014L, + 'selection_start': 4014L, 'zoom': 0L}, - 1622668581.689027], + 1622750556.288911], [loc('deepforest/main.py'), {'attrib-starts': [('deepforest|0|', 20), - ('deepforest|0|.use_bird_release|0|', - 90)], - 'code-line': ' # load saved model and tag release\n', - 'first-line': 87L, + ('deepforest|0|.evaluate|0|', + 394)], + 'code-line': ' # if no arg for iou_threshold, set as config'\ + '\n', + 'first-line': 417L, 'folded-linenos': [], - 'sel-line': 101L, - 'sel-line-start': 3791L, - 'selection_end': 3833L, - 'selection_start': 3833L, + 'sel-line': 425L, + 'sel-line-start': 17739L, + 'selection_end': 17791L, + 'selection_start': 17791L, 'zoom': 0L}, - 1622668612.657498], + 1622750601.338737], [loc('tests/test_main.py'), - {'attrib-starts': [('test_reload_multi_class|0|', - 232)], - 'code-line': ' old_model = torch.load("{}/checkpoint.pl".format'\ - '(tmpdir))\n', - 'first-line': 228L, + {'attrib-starts': [('test_train_callbacks|0|', + 198)], + 'code-line': ' csv_file = get_data("example.csv") \n', + 'first-line': 183L, 'folded-linenos': [], - 'sel-line': 238L, - 'sel-line-start': 8694L, - 'selection_end': 8755L, - 'selection_start': 8698L, + 'sel-line': 199L, + 'sel-line-start': 7198L, + 'selection_end': 7237L, + 'selection_start': 7237L, 'zoom': 0L}, - 1622668612.679296], + 1622751418.621089], [loc('tests/test_main.py'), - {'attrib-starts': [], - 'code-line': '#test main\n', - 'first-line': 251L, + {'attrib-starts': [('test_evaluate|0|', + 186)], + 'code-line': 'def test_evaluate(m, tmpdir):\n', + 'first-line': 174L, 'folded-linenos': [], - 'sel-line': 0L, - 'sel-line-start': 0L, - 'selection_end': 10L, - 'selection_start': 0L, + 'sel-line': 186L, + 'sel-line-start': 6654L, + 'selection_end': 6683L, + 'selection_start': 6654L, + 'zoom': 0L}, + 1622751479.023734], + [loc('../../opt/miniconda3/envs/test/lib/python3.7/site-packages/_pytest/config/__init__.py'), + {'attrib-starts': [('_assertion_supported|0|', + 1511)], + 'code-line': ' assert False\n', + 'first-line': 1494L, + 'folded-linenos': [], + 'sel-line': 1513L, + 'sel-line-start': 53863L, + 'selection_end': 53863L, + 'selection_start': 53863L, 'zoom': 0L}, - 1622668621.118596]], + 1622751495.226495]], 20), 'current-loc': loc('tests/test_main.py'), - 'editor-state-list': [(loc('../BirdDetector/utils/DOTA_pretraining.py'), + 'editor-state-list': [(loc('azure-pipelines.yml'), + {'attrib-starts': [], + 'code-line': ' pip install .\n', + 'first-line': 13L, + 'folded-linenos': [], + 'sel-line': 28L, + 'sel-line-start': 628L, + 'selection_end': 647L, + 'selection_start': 647L, + 'zoom': 0L}), + (loc('../../opt/miniconda3/envs/test/lib/python3.7/site-packages/_pytest/config/__init__.py'), + {'attrib-starts': [('_assertion_supported|0|', + 1511)], + 'code-line': ' assert False\n', + 'first-line': 1494L, + 'folded-linenos': [], + 'sel-line': 1513L, + 'sel-line-start': 53863L, + 'selection_end': 53863L, + 'selection_start': 53863L, + 'zoom': 0L}), + (loc('deepforest/__init__.py'), + {'attrib-starts': [], + 'code-line': '\n', + 'first-line': 0L, + 'folded-linenos': [], + 'sel-line': 5L, + 'sel-line-start': 161L, + 'selection_end': 161L, + 'selection_start': 161L, + 'zoom': 0L}), + (loc('dev_requirements.txt'), + {'attrib-starts': [], + 'code-line': 'sphinx_markdown_tables\n', + 'first-line': 0L, + 'folded-linenos': [], + 'sel-line': 20L, + 'sel-line-start': 196L, + 'selection_end': 218L, + 'selection_start': 218L, + 'zoom': 0L}), + (loc('../BirdDetector/utils/DOTA_pretraining.py'), {'attrib-starts': [('prepare|0|', 17)], 'code-line': ' train = pd.read_csv("/'\ @@ -766,27 +776,47 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window', 'selection_end': 2026L, 'selection_start': 1940L, 'zoom': 0L}), - (loc('../BirdDetector/generalization.py'), + (loc('environment.yml'), {'attrib-starts': [], - 'code-line': ' train_sets = ["terns","pal'\ - 'myra","penguins","pfeifer","hayes","everglades"]\n', - 'first-line': 571L, + 'code-line': ' - pytorch-lightning\n', + 'first-line': 7L, + 'folded-linenos': [], + 'sel-line': 18L, + 'sel-line-start': 235L, + 'selection_end': 256L, + 'selection_start': 256L, + 'zoom': 0L}), + (loc('../BirdDetector/generalization.py'), + {'attrib-starts': [('prepare_USGS|0|', + 400)], + 'code-line': ' patch_size=1200,\n', + 'first-line': 408L, 'folded-linenos': [], - 'sel-line': 581L, - 'sel-line-start': 27055L, - 'selection_end': 27069L, - 'selection_start': 27069L, + 'sel-line': 413L, + 'sel-line-start': 19287L, + 'selection_end': 19314L, + 'selection_start': 19314L, 'zoom': 0L}), (loc('docs/getting_started.md'), {'attrib-starts': [], 'code-line': '\n', - 'first-line': 35L, + 'first-line': 0L, 'folded-linenos': [], 'sel-line': 48L, 'sel-line-start': 2808L, 'selection_end': 2808L, 'selection_start': 2808L, 'zoom': 0L}), + (loc('docs/installation.md'), + {'attrib-starts': [], + 'code-line': '\n', + 'first-line': 28L, + 'folded-linenos': [], + 'sel-line': 3L, + 'sel-line-start': 173L, + 'selection_end': 173L, + 'selection_start': 173L, + 'zoom': 0L}), (loc('../DeepForest/docs/landing.md'), {'attrib-starts': [], 'code-line': '# What is DeepForest?\n', @@ -800,28 +830,60 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window', (loc('deepforest/main.py'), {'attrib-starts': [('deepforest|0|', 20), - ('deepforest|0|.use_bird_release|0|', - 90)], - 'code-line': ' # load saved model and'\ - ' tag release\n', - 'first-line': 87L, + ('deepforest|0|.evaluate|0|', + 394)], + 'code-line': ' # if no arg for iou_th'\ + 'reshold, set as config\n', + 'first-line': 417L, + 'folded-linenos': [], + 'sel-line': 425L, + 'sel-line-start': 17739L, + 'selection_end': 17791L, + 'selection_start': 17791L, + 'zoom': 0L}), + (loc('deepforest/predict.py'), + {'attrib-starts': [('predict_file|0|', + 63)], + 'code-line': ' image = np.array(I'\ + 'mage.open("{}/{}".format(root_dir,paths[index])))[:,:,::-1]\n', + 'first-line': 86L, + 'folded-linenos': [], + 'sel-line': 105L, + 'sel-line-start': 4014L, + 'selection_end': 4014L, + 'selection_start': 4014L, + 'zoom': 0L}), + (loc('setup.cfg'), + {'attrib-starts': [], + 'code-line': '[bumpversion]\n', + 'first-line': 0L, + 'folded-linenos': [], + 'sel-line': 0L, + 'sel-line-start': 0L, + 'selection_end': 0L, + 'selection_start': 0L, + 'zoom': 0L}), + (loc('setup.py'), + {'attrib-starts': [], + 'code-line': "VERSION = '0.2.4'\n", + 'first-line': 0L, 'folded-linenos': [], - 'sel-line': 101L, - 'sel-line-start': 3791L, - 'selection_end': 3833L, - 'selection_start': 3833L, + 'sel-line': 5L, + 'sel-line-start': 154L, + 'selection_end': 164L, + 'selection_start': 164L, 'zoom': 0L}), (loc('tests/test_main.py'), - {'attrib-starts': [('test_main|0|', - 78)], - 'code-line': ' from deepforest import mai'\ - 'n\n', - 'first-line': 69L, + {'attrib-starts': [('test_evaluate|0|', + 186)], + 'code-line': ' assert np.round(results["b'\ + 'ox_recall"],2) > 0.5\n', + 'first-line': 183L, 'folded-linenos': [], - 'sel-line': 79L, - 'sel-line-start': 2359L, - 'selection_end': 2390L, - 'selection_start': 2390L, + 'sel-line': 194L, + 'sel-line-start': 6980L, + 'selection_end': 7027L, + 'selection_start': 7027L, 'zoom': 0L}), (loc('deepforest/utilities.py'), {'attrib-starts': [('use_release|0|', @@ -834,21 +896,49 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window', 'sel-line-start': 3961L, 'selection_end': 3991L, 'selection_start': 3991L, + 'zoom': 0L}), + (loc('_config.yml'), + {'attrib-starts': [], + 'code-line': 'theme: jekyll-theme-slate', + 'first-line': 0L, + 'folded-linenos': [], + 'sel-line': 0L, + 'sel-line-start': 0L, + 'selection_end': 0L, + 'selection_start': 0L, 'zoom': 0L})], - 'has-focus': True, + 'has-focus': False, 'locked': False}, - [loc('../BirdDetector/utils/DOTA_pretraining.py'), + [loc('azure-pipelines.yml'), + loc('../../opt/miniconda3/envs/test/lib/python3.7/site-packages/_pytest/config/__init__.py'), + loc('deepforest/__init__.py'), + loc('dev_requirements.txt'), + loc('../BirdDetector/utils/DOTA_pretraining.py'), + loc('environment.yml'), loc('../BirdDetector/generalization.py'), loc('docs/getting_started.md'), + loc('docs/installation.md'), loc('../DeepForest/docs/landing.md'), loc('deepforest/main.py'), + loc('deepforest/predict.py'), + loc('setup.cfg'), + loc('setup.py'), loc('tests/test_main.py'), - loc('deepforest/utilities.py')]), - 'open_files': [u'../BirdDetector/generalization.py', - u'../BirdDetector/utils/DOTA_pretraining.py', - u'docs/getting_started.md', - u'../DeepForest/docs/landing.md', + loc('deepforest/utilities.py'), + loc('_config.yml')]), + 'open_files': [u'../BirdDetector/utils/DOTA_pretraining.py', u'deepforest/utilities.py', + u'../DeepForest/docs/landing.md', + u'_config.yml', + u'environment.yml', + u'docs/getting_started.md', + u'docs/installation.md', + u'setup.py', + u'setup.cfg', + u'deepforest/__init__.py', + u'azure-pipelines.yml', + u'dev_requirements.txt', + u'../BirdDetector/generalization.py', u'deepforest/main.py', u'tests/test_main.py']}, 'saved_notebook_display': None, @@ -857,7 +947,7 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window', 'tab_location': 'top', 'traversal_pos': ((1, 2), - 1622668846.180154), + 1622751500.964623), 'user_data': {}}, 'saved_notebook_display': None, 'split_percents': {0: 0.5}, @@ -872,8 +962,19 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window', 1747, 1059)}]} guimgr.recent-documents = [loc('tests/test_main.py'), + loc('../../opt/miniconda3/envs/test/lib/python3.7/site-packages/_pytest/config/__init__.py'), loc('deepforest/main.py'), - loc('deepforest/utilities.py'), + loc('deepforest/predict.py'), + loc('../BirdDetector/generalization.py'), + loc('dev_requirements.txt'), + loc('azure-pipelines.yml'), + loc('deepforest/__init__.py'), + loc('setup.cfg'), + loc('setup.py'), + loc('docs/installation.md'), + loc('docs/getting_started.md'), + loc('environment.yml'), + loc('_config.yml'), loc('../DeepForest/docs/landing.md')] guimgr.visual-state = {loc('../../../../Applications/WingPro.app/Contents/Resources/src/testing/runners/run_pytest_xml.py'): {'a'\ 'ttrib-starts': [('RunInSingleDir|0|', @@ -3356,20 +3457,13 @@ search.search-history = [u'label', u'visualize'] testing.stored-results = (1, [(u'/Users/benweinstein/Documents/DeepForest-pytorch/tests/test_utilities.py', - [('test_use_release', - 0, - None, - None, - None, - 1621976554, - 28), - ('test_float_warning', + [('test_project_boxes', 0, None, None, None, 1621976554, - 38), + 44), ('test_use_bird_release', 0, None, @@ -3377,352 +3471,411 @@ testing.stored-results = (1, None, 1622151342, 33), - ('test_project_boxes', + ('test_use_release', 0, None, None, None, 1621976554, - 44), + 28), ('test_xml_to_annotations', 0, None, None, None, 1621976554, - 19)]), - (u'/Users/benweinstein/Documents/DeepForest-pytorch/tests/test_preprocess.py', - [('test_split_raster', + 19), + ('test_float_warning', 0, None, None, None, - 1622413835, - 76), - ('test_select_annotations_tile', + 1621976554, + 38)]), + (u'/Users/benweinstein/Documents/DeepForest-pytorch/tests/test_evaluate.py', + [('test_evaluate_image', 0, None, None, None, - 1622413835, - 61), - ('test_split_raster_empty', + 1621459856, + 17), + ('test_evaluate_save_images', 0, None, None, None, - 1622413835, - 110), - ('test_split_size_error', + 1621459856, + 57), + ('test_evaluate', 0, None, None, None, - 1622413835, - 150), - ('test_select_annotations', + 1621459856, + 27), + ('test_evaluate_multi', 0, None, None, None, - 1622413835, - 46), - ('test_split_raster_from_image', + 1621459856, + 43)]), + (u'/Users/benweinstein/Documents/DeepForest-pytorch/tests/test_preprocess.py', + [('test_split_raster_from_image', 0, None, None, None, 1622413835, 97), - ('test_compute_windows', + ('test_select_annotations_tile', 0, None, None, None, 1622413835, - 40)]), - (u'/Users/benweinstein/Documents/DeepForest-pytorch/tests/test_callbacks.py', - [('test_log_images_multiclass', + 61), + ('test_split_raster', 0, None, None, None, - 1621286904, - 34), - ('test_log_images', + 1622413835, + 76), + ('test_split_size_error', 0, None, None, None, - 1621286904, - 25)]), - (u'/Users/benweinstein/Documents/DeepForest-pytorch/tests/test_IoU.py', - [('test_compute_IoU', + 1622413835, + 150), + ('test_split_raster_empty', 0, None, None, None, - 1621282562, - 13)]), - (u'/Users/benweinstein/Documents/DeepForest-pytorch/tests/test_environment.py', - [('test_environment', + 1622413835, + 110), + ('test_compute_windows', 0, None, None, None, - 1621276174, - 3)]), - (u'/Users/benweinstein/Documents/DeepForest-pytorch/tests/test_main.py', - [('test_predict_return_plot', + 1622413835, + 40), + ('test_select_annotations', 0, None, None, None, - 1622514427, - 122), - ('test_train_no_validation', + 1622413835, + 46)]), + (u'/Users/benweinstein/Documents/DeepForest-pytorch/tests/test_visualize.py', + [('test_format_boxes', 0, None, None, None, - 1622514427, - 90), - ('test_save_and_reload', + 1622413843, + 23), + ('test_plot_predictions[0]', 0, None, None, None, - 1622514427, - 215), - ('test_train_multi', + 1622413843, + 34), + ('test_plot_prediction_dataframe', 0, None, None, None, - 1622514427, - 87), - ('test_predict_image_fromfile', + 1622413843, + 50), + ('test_plot_predictions[20]', 0, None, None, None, - 1622514427, - 102), - ('test_train_callbacks', + 1622413843, + 34), + ('test_plot_predictions_and_targets', 0, None, None, None, - 1622514427, - 194), - ('test_main', + 1622413843, + 61), + ('test_plot_predictions[1]', 0, None, None, None, - 1622514427, - 78), - ('test_predict_small_file', + 1622413843, + 34)]), + (u'/Users/benweinstein/Documents/DeepForest-pytorch/tests/test_IoU.py', + [('test_compute_IoU', 0, None, None, None, - 1622514427, - 137), - ('test_override_transforms', + 1621282562, + 13)]), + (u'/Users/benweinstein/Documents/DeepForest-pytorch/tests/test_data.py', + [('test_get_data', 0, None, None, None, - 1622514427, - 236), - ('test_predict_image_fromarray', + 1621276174, + 7)]), + (u'/Users/benweinstein/Documents/DeepForest-pytorch/tests/test_model.py', + [('test_load_backbone', 0, None, None, None, - 1622514427, - 109), - ('test_train_single', + 1622512518, + 6), + ('test_create_model[10]', 0, None, None, None, - 1622514427, - 84), - ('test_predict_image_empty', + 1622512518, + 12), + ('test_create_model[2]', 0, None, None, None, - 1622514427, - 96), - ('test_predict_big_file', + 1622512518, + 12), + ('test_create_model[1]', 0, None, None, None, - 1622514427, - 128), - ('test_predict_tile', + 1622512518, + 12)]), + (u'/Users/benweinstein/Documents/DeepForest-pytorch/tests/test_callbacks.py', + [('test_log_images_multiclass', 0, None, None, None, - 1622514427, - 146), - ('test_evaluate', + 1621286904, + 34), + ('test_log_images', 0, None, None, None, - 1622514427, - 183), - ('test_use_bird_release', + 1621286904, + 25)]), + (u'/Users/benweinstein/Documents/DeepForest-pytorch/tests/test_environment.py', + [('test_environment', 0, None, None, None, - 1622668759, - 81), - ('test_reload_multi_class', + 1621276174, + 3)]), + (u'/Users/benweinstein/Documents/DeepForest-pytorch/tests/test_main.py', + [('test_use_bird_release', 0, None, None, None, - 1622516145, - 232)]), - (u'/Users/benweinstein/Documents/DeepForest-pytorch/tests/test_model.py', - [('test_create_model[2]', + 1622751220, + 81), + ('test_predict_image_fromfile', 0, None, None, None, - 1622512518, - 12), - ('test_create_model[1]', - 0, + 1622751220, + 105), + ('test_override_transforms', + 'running', None, None, None, - 1622512518, - 12), - ('test_load_backbone', + None, + None), + ('test_main', 0, None, None, None, - 1622512518, - 6), - ('test_create_model[10]', - 0, + 1622751220, + 78), + ('test_train_callbacks', + 'running', None, None, None, - 1622512518, - 12)]), - (u'/Users/benweinstein/Documents/DeepForest-pytorch/tests/test_evaluate.py', - [('test_evaluate_image', - 0, None, + None), + ('test_save_and_reload', + 'running', None, None, - 1621459856, - 17), - ('test_evaluate_multi', - 0, None, None, + None), + ('test_predict_tile', + 'running', None, - 1621459856, - 43), - ('test_evaluate_save_images', - 0, None, None, None, - 1621459856, - 57), - ('test_evaluate', - 0, + None), + ('test_predict_big_file', + 'running', None, None, None, - 1621459856, - 27)]), - (u'/Users/benweinstein/Documents/DeepForest-pytorch/tests/test_visualize.py', - [('test_plot_predictions[0]', + None, + None), + ('test_train_multi', 0, None, None, None, - 1622413843, - 34), - ('test_plot_predictions[20]', - 0, + 1622751220, + 90), + ('test_predict_return_plot', + 'running', None, None, None, - 1622413843, - 34), - ('test_plot_predictions_and_targets', - 0, None, + None), + ('test_predict_small_file', + 'running', None, None, - 1622413843, - 61), - ('test_plot_predictions[1]', - 0, None, None, + None), + ('test_reload_multi_class', + 'running', None, - 1622413843, - 34), - ('test_format_boxes', + None, + None, + None, + None), + ('test_train_single', 0, None, None, None, - 1622413843, - 23), - ('test_plot_prediction_dataframe', + 1622751220, + 87), + ('test_predict_image_fromarray', + 'running', + None, + None, + None, + None, + None), + ('test_train_no_validation', 0, None, None, None, - 1622413843, - 50)]), - (u'/Users/benweinstein/Documents/DeepForest-pytorch/tests/test_data.py', - [('test_get_data', + 1622751220, + 93), + ('test_evaluate', + 1, + None, + None, + ('', + "", + "AssertionError: assert 2 == 1\n + where 2 ="\ + " len(array(['Tree', nan], dtype=object))\n +"\ + " where array(['Tree', nan], dtype=object)"\ + " = ()\n + where = 31 Tree\\n4"\ + "1 Tree\\n17 Tree\\n50 Tree\\n34 "\ + "Tree\\n ... \\n26 Tree\\n42 Tree"\ + "\\n0 NaN\\n10 Tree\\n1 Tree\\nNa"\ + "me: predicted_label, Length: 61, dtype: obje"\ + "ct.unique\n + where 31 Tree\\n41 "\ + " Tree\\n17 Tree\\n50 Tree\\n34 Tre"\ + "e\\n ... \\n26 Tree\\n42 Tree\\n0"\ + " NaN\\n10 Tree\\n1 Tree\\nName: "\ + "predicted_label, Length: 61, dtype: object ="\ + " prediction_id truth_id IoU ... t"\ + "rue_label image_path match\\n31 "\ + " 31 0 0.000000 ... ...e OSBS_"\ + "029.tif True\\n1 1 60 "\ + " 0.763430 ... Tree OSBS_029.tif Tr"\ + "ue\\n\\n[61 rows x 7 columns].predicted_labe"\ + "l", + [(u'/Users/benweinstein/Documents/DeepForest-pytorch/tests/test_main.py', + '/Users/benweinstein/Documents/DeepForest-p'\ + 'ytorch/tests/test_main.py', + 196, + 'test_evaluate', + None, + ' assert len(results["results"].predicte'\ + 'd_label.unique()) == 1')], + 0, + None, + None, + None, + None), + 1622751468, + 186), + ('test_predict_image_empty', 0, None, None, None, - 1621276174, - 7)]), + 1622751220, + 99)]), (u'/Users/benweinstein/Documents/DeepForest-pytorch/tests/test_dataset.py', - [('test_TreeDataset_transform[False]', + [('test_TreeDataset_transform[True]', 0, None, None, None, 1621616826, 40), - ('test_TreeDataset_transform[True]', + ('test_TreeDataset_transform[False]', 0, None, None, None, 1621616826, 40), - ('test_predict_dataloader', + ('test_TreeDataset[/Users/benweinstein/Document'\ + 's/DeepForest-pytorch/deepforest/data/testfile'\ + '_multi.csv-label_dict1]', 0, None, None, None, 1621616826, - 88), + 20), ('test_TreeDataset[/Users/benweinstein/Document'\ 's/DeepForest-pytorch/deepforest/data/example.'\ 'csv-label_dict0]', @@ -3732,28 +3885,26 @@ testing.stored-results = (1, None, 1621616826, 20), - ('test_collate', + ('test_predict_dataloader', 0, None, None, None, 1621616826, - 60), - ('test_TreeDataset[/Users/benweinstein/Document'\ - 's/DeepForest-pytorch/deepforest/data/testfile'\ - '_multi.csv-label_dict1]', + 88), + ('test_empty_collate', 0, None, None, None, 1621616826, - 20), - ('test_empty_collate', + 74), + ('test_collate', 0, None, None, None, 1621616826, - 74)])], + 60)])], {u'/Users/benweinstein/Documents/DeepForest/tests/test_deepforest.py': (u'Test process aborted: some tests were not run', 1607966490)}) diff --git a/tests/test_main.py b/tests/test_main.py index 970511fa..a1020dcb 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -193,7 +193,8 @@ def test_evaluate(m, tmpdir): #Does this make reasonable predictions, we know the model works. assert np.round(results["box_precision"],2) > 0.5 assert np.round(results["box_recall"],2) > 0.5 - assert results["results"].predicted_label.unique() == ["Tree"] + assert len(results["results"].predicted_label.dropna().unique()) == 1 + assert results["results"].predicted_label.dropna().unique()[0] == "Tree" def test_train_callbacks(m): csv_file = get_data("example.csv")