Skip to content

Commit

Permalink
v0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
flystarhe committed Feb 22, 2021
1 parent c0d8362 commit 2d8598d
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 8 deletions.
2 changes: 1 addition & 1 deletion cvtk/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.0.2"
__version__ = "0.1.0"
5 changes: 3 additions & 2 deletions cvtk/io/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .image import imread, bgr2rgb, rgb2bgr
from .image import imread, bgr2rgb, rgb2bgr, convert_color_factory
from .json import json_dumps, json_loads
from .utils import make_dir, increment_path
from .utils import copyfile, copyfile2
Expand All @@ -7,7 +7,8 @@


__all__ = [
"imread", "bgr2rgb", "rgb2bgr", "json_dumps", "json_loads",
"imread", "bgr2rgb", "rgb2bgr", "convert_color_factory",
"json_dumps", "json_loads",
"make_dir", "increment_path", "copyfile", "copyfile2",
"load_csv", "load_pkl", "load_json", "save_csv", "save_json", "save_pkl"
]
2 changes: 1 addition & 1 deletion cvtk/model_selection/coco.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def _split(self, groups, seed):

np.random.seed(seed)
np.random.shuffle(image_ids)
if p >= len(image_ids) * 0.8:
if p >= len(image_ids):
test_index.extend(image_ids)
train_index.extend(image_ids)
else:
Expand Down
6 changes: 3 additions & 3 deletions cvtk/utils/abc/coco_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ def _filter(img_dir, ann_dir, include=None):
include = Path(include)
if include.is_dir():
targets = [x for x in include.glob("**/*")]
elif include.suffix == ".csv":
elif include.suffix == ".csv": # from hiplot
targets = pd.read_csv(include)["file_name"].tolist()
elif include.suffix == ".json":
elif include.suffix == ".json": # from coco dataset
targets = [img["file_name"] for img in load_json(include)["images"]]
else:
raise NotImplementedError(f"Not Implemented file type: {include.name}")
Expand Down Expand Up @@ -130,8 +130,8 @@ def make_dataset(img_dir, ann_dir=None, out_dir=None, include=None, mapping=None
labels = set()
for _, ann_data in imdb:
labels.update([s["label"] for s in ann_data["shapes"]])

labels = sorted(labels)

cat_index = {l: i for i, l in enumerate(labels)}

imgs, anns = [], []
Expand Down
4 changes: 3 additions & 1 deletion cvtk/utils/abc/patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ def parse_args():

def main():
args = parse_args()
print(patch_dataset(**vars(args)))
kw = vars(args)

print(patch_dataset(**kw))


if __name__ == "__main__":
Expand Down
7 changes: 7 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# requirements.txt
hiplot>=0.1.23
lxml==4.6.2
networkx
numpy
opencv-contrib-python>=4.5.1
pandas
requests
simplejson
tqdm

0 comments on commit 2d8598d

Please sign in to comment.