Skip to content

Commit 10b2e0c

Browse files
authored
Merge pull request #1814 from wkentaro/refactor_/rename_store_data_to_with_image_data_and_default_to_false
refactor!: rename store_data to with_image_data and default to false
2 parents e89f884 + ff704fb commit 10b2e0c

File tree

11 files changed

+31
-16
lines changed

11 files changed

+31
-16
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ labelme # just open gui
9898
cd examples/tutorial
9999
labelme apc2016_obj3.jpg # specify image file
100100
labelme apc2016_obj3.jpg --output annotations/ # save annotation JSON files to a directory
101-
labelme apc2016_obj3.jpg --nodata # not include image data but relative image path in JSON file
101+
labelme apc2016_obj3.jpg --with-image-data # include image data in JSON file
102102
labelme apc2016_obj3.jpg \
103103
--labels highland_6539_self_stick_notes,mead_index_cards,kong_air_dog_squeakair_tennis_ball # specify label list
104104

examples/bbox_detection/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
## Usage
55

66
```bash
7-
labelme data_annotated --labels labels.txt --nodata --autosave
7+
labelme data_annotated --labels labels.txt --autosave
88
```
99

1010
![](.readme/annotation.jpg)

examples/classification/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
## Usage
55

66
```bash
7-
labelme data_annotated --flags flags.txt --nodata
7+
labelme data_annotated --flags flags.txt
88
```
99

1010
<img src=".readme/annotation_cat.jpg" width="100%" />

examples/instance_segmentation/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
## Annotation
44

55
```bash
6-
labelme data_annotated --labels labels.txt --nodata --validatelabel exact --config '{shift_auto_shape_color: -2}'
7-
labelme data_annotated --labels labels.txt --nodata --labelflags '{.*: [occluded, truncated], person: [male]}'
6+
labelme data_annotated --labels labels.txt --validatelabel exact --config '{shift_auto_shape_color: -2}'
7+
labelme data_annotated --labels labels.txt --labelflags '{.*: [occluded, truncated], person: [male]}'
88
```
99

1010
![](.readme/annotation.jpg)

examples/semantic_segmentation/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
## Annotation
44

55
```bash
6-
labelme data_annotated --labels labels.txt --nodata --validatelabel exact --config '{shift_auto_shape_color: -2}'
6+
labelme data_annotated --labels labels.txt --validatelabel exact --config '{shift_auto_shape_color: -2}'
77
```
88

99
![](.readme/annotation.jpg)

examples/video_annotation/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
## Annotation
55

66
```bash
7-
labelme data_annotated --labels labels.txt --nodata --keep-prev --config '{shift_auto_shape_color: -2}'
7+
labelme data_annotated --labels labels.txt --keep-prev --config '{shift_auto_shape_color: -2}'
88
```
99

1010
<img src=".readme/00000100.jpg" width="49%" /> <img src=".readme/00000101.jpg" width="49%" />

labelme/__main__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,10 @@ def main():
122122
)
123123
# config for the gui
124124
parser.add_argument(
125-
"--nodata",
126-
dest="store_data",
127-
action="store_false",
128-
help="stop storing image data to JSON file",
125+
"--with-image-data",
126+
dest="with_image_data",
127+
action="store_true",
128+
help="store image data in JSON file",
129129
default=argparse.SUPPRESS,
130130
)
131131
parser.add_argument(

labelme/app.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ def __init__(
341341
slot=self.enableSaveImageWithData,
342342
tip=self.tr("Save image data in label file"),
343343
checkable=True,
344-
checked=self._config["store_data"],
344+
checked=self._config["with_image_data"],
345345
)
346346

347347
close = action(
@@ -1522,7 +1522,7 @@ def format_shape(s):
15221522
try:
15231523
assert self.imagePath
15241524
imagePath = osp.relpath(self.imagePath, osp.dirname(filename))
1525-
imageData = self.imageData if self._config["store_data"] else None
1525+
imageData = self.imageData if self._config["with_image_data"] else None
15261526
if osp.dirname(filename) and not osp.exists(osp.dirname(filename)):
15271527
os.makedirs(osp.dirname(filename))
15281528
lf.save(
@@ -1931,7 +1931,7 @@ def scaleFitWidth(self):
19311931
return w / self.canvas.pixmap.width()
19321932

19331933
def enableSaveImageWithData(self, enabled):
1934-
self._config["store_data"] = enabled
1934+
self._config["with_image_data"] = enabled
19351935
self.actions.saveWithImageData.setChecked(enabled)
19361936

19371937
def closeEvent(self, a0: QtGui.QCloseEvent) -> None:

labelme/config/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ def _migrate_config_from_file(config_from_yaml: dict) -> None:
4141
)
4242
config_from_yaml["keep_prev_brightness_contrast"] = True
4343

44+
if "store_data" in config_from_yaml:
45+
logger.info("Migrating old config: store_data -> with_image_data")
46+
config_from_yaml["with_image_data"] = config_from_yaml.pop("store_data")
47+
4448
if config_from_yaml.get("shortcuts", {}).pop("add_point_to_edge", None):
4549
logger.info("Migrating old config: removing shortcuts.add_point_to_edge")
4650

@@ -68,8 +72,8 @@ def get_user_config_file(create_if_missing: bool = True) -> str:
6872
"# https://github.com/wkentaro/labelme/blob/main/labelme/config/default_config.yaml\n"
6973
"#\n"
7074
"# Example:\n"
75+
"# with_image_data: true\n"
7176
"# auto_save: true\n"
72-
"# store_data: false\n"
7377
"# labels: [cat, dog]\n"
7478
)
7579
except Exception:

labelme/config/default_config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
auto_save: false
22
display_label_popup: true
3-
store_data: true
3+
with_image_data: false
44
keep_prev: false
55
keep_prev_scale: false
66
keep_prev_brightness_contrast: false

0 commit comments

Comments
 (0)