Commit
•
f23d3fc
1
Parent(s):
c2ee4f4
draft
Browse files- README.md +49 -0
- amazonian_fish_classifier.py +113 -0
README.md
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
dataset_info:
|
3 |
+
features:
|
4 |
+
- name: image
|
5 |
+
dtype: image
|
6 |
+
- name: label
|
7 |
+
dtype:
|
8 |
+
class_label:
|
9 |
+
names:
|
10 |
+
'0': Ancistrus
|
11 |
+
'1': Apistogramma
|
12 |
+
'2': Astyanax
|
13 |
+
'3': Bario
|
14 |
+
'4': Bryconops
|
15 |
+
'5': Bujurquina
|
16 |
+
'6': Bunocephalus
|
17 |
+
'7': Characidium
|
18 |
+
'8': Charax
|
19 |
+
'9': Copella
|
20 |
+
'10': Corydoras
|
21 |
+
'11': Creagrutus
|
22 |
+
'12': Curimata
|
23 |
+
'13': Doras
|
24 |
+
'14': Erythrinus
|
25 |
+
'15': Gasteropelecus
|
26 |
+
'16': Gymnotus
|
27 |
+
'17': Hemigrammus
|
28 |
+
'18': Hyphessobrycon
|
29 |
+
'19': Knodus
|
30 |
+
'20': Moenkhausia
|
31 |
+
'21': Otocinclus
|
32 |
+
'22': Oxyropsis
|
33 |
+
'23': Phenacogaster
|
34 |
+
'24': Pimelodella
|
35 |
+
'25': Prochilodus
|
36 |
+
'26': Pygocentrus
|
37 |
+
'27': Pyrrhulina
|
38 |
+
'28': Rineloricaria
|
39 |
+
'29': Sorubim
|
40 |
+
'30': Tatia
|
41 |
+
'31': Tetragonopterus
|
42 |
+
'32': Tyttocharax
|
43 |
+
splits:
|
44 |
+
- name: train
|
45 |
+
num_bytes: 578234
|
46 |
+
num_examples: 3068
|
47 |
+
download_size: 330399200
|
48 |
+
dataset_size: 578234
|
49 |
+
---
|
amazonian_fish_classifier.py
ADDED
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
|
2 |
+
#
|
3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4 |
+
# you may not use this file except in compliance with the License.
|
5 |
+
# You may obtain a copy of the License at
|
6 |
+
#
|
7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8 |
+
#
|
9 |
+
# Unless required by applicable law or agreed to in writing, software
|
10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12 |
+
# See the License for the specific language governing permissions and
|
13 |
+
# limitations under the License.
|
14 |
+
"""TODO."""
|
15 |
+
|
16 |
+
|
17 |
+
import os
|
18 |
+
from pathlib import Path
|
19 |
+
import pandas as pd
|
20 |
+
import datasets
|
21 |
+
|
22 |
+
_CITATION = """TODO"""
|
23 |
+
|
24 |
+
|
25 |
+
_DESCRIPTION = """\
|
26 |
+
TODO
|
27 |
+
"""
|
28 |
+
|
29 |
+
_HOMEPAGE = "https://doi.org/10.25573/data.17314730.v1"
|
30 |
+
|
31 |
+
_LICENSE = "CC BY 4.0"
|
32 |
+
|
33 |
+
|
34 |
+
_URLS = {
|
35 |
+
"images": "https://smithsonian.figshare.com/ndownloader/files/31975544",
|
36 |
+
}
|
37 |
+
|
38 |
+
|
39 |
+
class AmazonianFish(datasets.GeneratorBasedBuilder):
|
40 |
+
"""TODO"""
|
41 |
+
|
42 |
+
VERSION = datasets.Version("1.1.0")
|
43 |
+
|
44 |
+
def _info(self):
|
45 |
+
features = datasets.Features(
|
46 |
+
{
|
47 |
+
"image": datasets.Image(),
|
48 |
+
"label": datasets.ClassLabel(
|
49 |
+
names=[
|
50 |
+
"Ancistrus",
|
51 |
+
"Apistogramma",
|
52 |
+
"Astyanax",
|
53 |
+
"Bario",
|
54 |
+
"Bryconops",
|
55 |
+
"Bujurquina",
|
56 |
+
"Bunocephalus",
|
57 |
+
"Characidium",
|
58 |
+
"Charax",
|
59 |
+
"Copella",
|
60 |
+
"Corydoras",
|
61 |
+
"Creagrutus",
|
62 |
+
"Curimata",
|
63 |
+
"Doras",
|
64 |
+
"Erythrinus",
|
65 |
+
"Gasteropelecus",
|
66 |
+
"Gymnotus",
|
67 |
+
"Hemigrammus",
|
68 |
+
"Hyphessobrycon",
|
69 |
+
"Knodus",
|
70 |
+
"Moenkhausia",
|
71 |
+
"Otocinclus",
|
72 |
+
"Oxyropsis",
|
73 |
+
"Phenacogaster",
|
74 |
+
"Pimelodella",
|
75 |
+
"Prochilodus",
|
76 |
+
"Pygocentrus",
|
77 |
+
"Pyrrhulina",
|
78 |
+
"Rineloricaria",
|
79 |
+
"Sorubim",
|
80 |
+
"Tatia",
|
81 |
+
"Tetragonopterus",
|
82 |
+
"Tyttocharax",
|
83 |
+
]
|
84 |
+
),
|
85 |
+
}
|
86 |
+
)
|
87 |
+
|
88 |
+
return datasets.DatasetInfo(
|
89 |
+
description=_DESCRIPTION,
|
90 |
+
features=features,
|
91 |
+
homepage=_HOMEPAGE,
|
92 |
+
license=_LICENSE,
|
93 |
+
citation=_CITATION,
|
94 |
+
)
|
95 |
+
|
96 |
+
def _split_generators(self, dl_manager):
|
97 |
+
images = dl_manager.download_and_extract(_URLS["images"])
|
98 |
+
return [
|
99 |
+
datasets.SplitGenerator(
|
100 |
+
name=datasets.Split.TRAIN,
|
101 |
+
gen_kwargs={
|
102 |
+
"images": os.path.join(images,"training_images"),
|
103 |
+
},
|
104 |
+
),
|
105 |
+
]
|
106 |
+
|
107 |
+
def _generate_examples(self, images):
|
108 |
+
id_ = 0
|
109 |
+
for example in Path(images).rglob("*.jpg"):
|
110 |
+
if example.name.startswith("._"):
|
111 |
+
continue
|
112 |
+
id_ += 1
|
113 |
+
yield id_, {"image": str(example), "label": example.parent.name}
|