-
Notifications
You must be signed in to change notification settings - Fork 174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TEST]: Pr813 #815
Open
henrykironde
wants to merge
4
commits into
weecology:main
Choose a base branch
from
henrykironde:PR813
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
[TEST]: Pr813 #815
+174
−59
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ben I tested the PR #813, With a few changes we were able to go from 11 failed to 3 failed. Some errors are here tests/test_visualize.py::test_predict_image_and_plot FAILED [100%]
============================================================================= FAILURES =============================================================================
___________________________________________________________________ test_predict_image_and_plot ____________________________________________________________________
m = deepforest(
(model): RetinaNet(
(backbone): BackboneWithFPN(
(body): IntermediateLayerGetter(
(con..._size=1333, mode='bilinear')
)
)
(iou_metric): IntersectionOverUnion()
(mAP_metric): MeanAveragePrecision()
)
tmpdir = local('/private/var/folders/5r/ggnt4_dx6_z0gspdn36dkprc0000gn/T/pytest-of-henrysenyondo/pytest-13/test_predict_image_and_plot0')
def test_predict_image_and_plot(m, tmpdir):
sample_image_path = get_data("OSBS_029.png")
results = m.predict_image(path=sample_image_path)
> visualize.plot_results(results, savedir=tmpdir)
tests/test_visualize.py:72:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
deepforest/visualize.py:485: in plot_results
root_dir = results.root_dir
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = xmin ymin xmax ymax label score image_path
0 330.0 342.0 373.0 391.0 Tree 0.802979 OSBS_029.... 0.0 375.0 8.0 397.0 Tree 0.315891 OSBS_029.png
55 162.0 264.0 188.0 292.0 Tree 0.306989 OSBS_029.png
name = 'root_dir'
@final
def __getattr__(self, name: str):
"""
After regular attribute access, try looking up the name
This allows simpler access to columns for interactive use.
"""
# Note: obj.x will always call obj.__getattribute__('x') prior to
# calling obj.__getattr__('x').
if (
name not in self._internal_names_set
and name not in self._metadata
and name not in self._accessors
and self._info_axis._can_hold_identifiers_and_holds_name(name)
):
return self[name]
> return object.__getattribute__(self, name)
E AttributeError: 'DataFrame' object has no attribute 'root_dir'
/opt/miniconda3/envs/deepforest/lib/python3.11/site-packages/pandas/core/generic.py:6299: AttributeError
---------------------------------------------------------------------- Captured stdout setup -----------------------------------------------------------------------
running Another tests/test_main.py::test_predict_image_fromarray FAILED [100%]
====================================================================================== FAILURES =======================================================================================
____________________________________________________________________________ test_predict_image_fromarray _____________________________________________________________________________
m = deepforest(
(model): RetinaNet(
(backbone): BackboneWithFPN(
(body): IntermediateLayerGetter(
(con..._size=1333, mode='bilinear')
)
)
(iou_metric): IntersectionOverUnion()
(mAP_metric): MeanAveragePrecision()
)
def test_predict_image_fromarray(m):
image_path = get_data(path="2019_YELL_2_528000_4978000_image_crop2.png")
# assert error of dtype
with pytest.raises(TypeError):
image = Image.open(image_path)
prediction = m.predict_image(image=image)
image = np.array(Image.open(image_path).convert("RGB"))
with pytest.warns(UserWarning, match="Image type is uint8, transforming to float32"):
> prediction = m.predict_image(image=image)
tests/test_main.py:231:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
deepforest/main.py:418: in predict_image
results = utilities.read_file(result)
deepforest/utilities.py:318: in read_file
return shapefile_to_annotations(input, root_dir=root_dir)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
shapefile = xmin ymin xmax ymax label score geometry
0 1695.0 2265...25, 378 18, 73...
44 28.0 1083.0 586.0 1722.0 Tree 0.103576 POLYGON ((586 1083, 586 1722, 28 1722, 28 1083...
rgb = None, root_dir = None, buffer_size = None, convert_point = False, geometry_type = None, save_dir = None
def shapefile_to_annotations(shapefile,
rgb=None,
root_dir=None,
buffer_size=None,
convert_point=False,
geometry_type=None,
save_dir=None):
"""Convert a shapefile of annotations into annotations csv file for
DeepForest training and evaluation.
Args:
shapefile: Path to a shapefile on disk. If a label column is present, it will be used, else all labels are assumed to be "Tree"
rgb: Path to the RGB image on disk
root_dir: Optional directory to prepend to the image_path column
Returns:
results: a pandas dataframe
"""
# Deprecation of previous arguments
if geometry_type:
warnings.warn(
"geometry_type argument is deprecated and will be removed in DeepForest 2.0. The function will infer geometry from the shapefile directly.",
DeprecationWarning)
if save_dir:
warnings.warn(
"save_dir argument is deprecated and will be removed in DeepForest 2.0. The function will return a pandas dataframe instead of saving to disk.",
DeprecationWarning)
# Read shapefile
if isinstance(shapefile, str):
gdf = gpd.read_file(shapefile)
else:
gdf = shapefile.copy(deep=True)
if rgb is None:
if "image_path" not in gdf.columns:
> raise ValueError(
"No image_path column found in shapefile, please specify rgb path")
E ValueError: No image_path column found in shapefile, please specify rgb path
deepforest/utilities.py:189: ValueError
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.