[go: nahoru, domu]

Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

OD predict function shouldn't depend on the annotation column #2830

Closed
jakesabathia2 opened this issue Dec 9, 2019 · 1 comment · Fixed by #2832
Closed

OD predict function shouldn't depend on the annotation column #2830

jakesabathia2 opened this issue Dec 9, 2019 · 1 comment · Fixed by #2832
Assignees
Milestone

Comments

@jakesabathia2
Copy link
Collaborator

Now the predict function for OD is still depending on the annotation column.

repro:

import turicreate as tc

data = tc.SFrame('ig02.sframe')

data.remove_column("name", inplace=True)
data.remove_column("label", inplace=True)
print(data)

train_data, test_data = data.random_split(0.8, seed=1)
model = tc.object_detector.create(train_data, max_iterations=1)

alt_train_data = train_data["annotations"].apply(lambda x: "invalid")
bad_train_data = train_data.remove_column("annotations")
bad_train_data = bad_train_data.add_column(alt_train_data, "annotations")

print(bad_train_data)
print(isinstance(bad_train_data, tc.SFrame))
pred = model.predict(bad_train_data)

5.8:

+------------------------+-------------------------------+
|         image          |          annotations          |
+------------------------+-------------------------------+
| Height: 480 Width: 640 | [{'coordinates': {'y': 296... |
| Height: 480 Width: 640 | [{'coordinates': {'y': 242... |
| Height: 480 Width: 640 | [{'coordinates': {'y': 266... |
| Height: 480 Width: 640 | [{'coordinates': {'y': 162... |
| Height: 480 Width: 640 | [{'coordinates': {'y': 240... |
| Height: 480 Width: 640 | [{'coordinates': {'y': 248... |
| Height: 480 Width: 640 | [{'coordinates': {'y': 221... |
| Height: 480 Width: 640 | [{'coordinates': {'y': 144... |
| Height: 480 Width: 640 | [{'coordinates': {'y': 222... |
| Height: 480 Width: 640 | [{'coordinates': {'y': 286... |
+------------------------+-------------------------------+
[785 rows x 2 columns]
Note: Only the head of the SFrame is printed.
You can use print_rows(num_rows=m, num_columns=n) to print more rows and columns.
Using 'image' as feature column
Using 'annotations' as annotations column
Setting 'batch_size' to 32
Using GPU to create model (AMD Radeon Pro 560X)
+--------------+--------------+--------------+
| Iteration    | Loss         | Elapsed Time |
+--------------+--------------+--------------+
| 1            | 6.235        | 9.6          |
+--------------+--------------+--------------+
+------------------------+-------------+
|         image          | annotations |
+------------------------+-------------+
| Height: 480 Width: 640 |   invalid   |
| Height: 480 Width: 640 |   invalid   |
| Height: 480 Width: 640 |   invalid   |
| Height: 480 Width: 640 |   invalid   |
| Height: 480 Width: 640 |   invalid   |
| Height: 480 Width: 640 |   invalid   |
| Height: 480 Width: 640 |   invalid   |
| Height: 480 Width: 640 |   invalid   |
| Height: 480 Width: 640 |   invalid   |
| Height: 480 Width: 640 |   invalid   |
+------------------------+-------------+
[629 rows x 2 columns]
Note: Only the head of the SFrame is printed.
You can use print_rows(num_rows=m, num_columns=n) to print more rows and columns.
True
Predicting   1/629
Predicting  97/629
Predicting 193/629
Predicting 289/629
Predicting 385/629
Predicting 481/629
Predicting 577/629
Predicting 629/629
/Users/henry/Desktop/test/od_visual/venv_5_8/lib/python2.7/site-packages/turicreate/aggregate.py:92: UserWarning: Passing parameter(s) to COUNT is deprecated. This functionality will be removed in the next major release. Any passed parameters are ignored.
  + 'the next major release. Any passed parameters are ignored.')

6.0:

+------------------------+-------------------------------+
|         image          |          annotations          |
+------------------------+-------------------------------+
| Height: 480 Width: 640 | [{'coordinates': {'y': 296... |
| Height: 480 Width: 640 | [{'coordinates': {'y': 242... |
| Height: 480 Width: 640 | [{'coordinates': {'y': 266... |
| Height: 480 Width: 640 | [{'coordinates': {'y': 162... |
| Height: 480 Width: 640 | [{'coordinates': {'y': 240... |
| Height: 480 Width: 640 | [{'coordinates': {'y': 248... |
| Height: 480 Width: 640 | [{'coordinates': {'y': 221... |
| Height: 480 Width: 640 | [{'coordinates': {'y': 144... |
| Height: 480 Width: 640 | [{'coordinates': {'y': 222... |
| Height: 480 Width: 640 | [{'coordinates': {'y': 286... |
+------------------------+-------------------------------+
[785 rows x 2 columns]
Note: Only the head of the SFrame is printed.
You can use print_rows(num_rows=m, num_columns=n) to print more rows and columns.
Using 'image' as feature column
Using 'annotations' as annotations column
Using GPU to create model (AMD Radeon Pro 560X)
Setting 'batch_size' to 32
+--------------+--------------+--------------+
| Iteration    | Loss         | Elapsed Time |
+--------------+--------------+--------------+
| 1            | 5.23736      | 1.08s        |
+--------------+--------------+--------------+
+------------------------+-------------+
|         image          | annotations |
+------------------------+-------------+
| Height: 480 Width: 640 |   invalid   |
| Height: 480 Width: 640 |   invalid   |
| Height: 480 Width: 640 |   invalid   |
| Height: 480 Width: 640 |   invalid   |
| Height: 480 Width: 640 |   invalid   |
| Height: 480 Width: 640 |   invalid   |
| Height: 480 Width: 640 |   invalid   |
| Height: 480 Width: 640 |   invalid   |
| Height: 480 Width: 640 |   invalid   |
| Height: 480 Width: 640 |   invalid   |
+------------------------+-------------+
[629 rows x 2 columns]
Note: Only the head of the SFrame is printed.
You can use print_rows(num_rows=m, num_columns=n) to print more rows and columns.
True
Traceback (most recent call last):
  File "od_message.py", line 18, in <module>
    pred = model.predict(bad_train_data)
  File "/Users/henry/Desktop/turicreate/release/src/python/turicreate/toolkits/object_detector/object_detector.py", line 1730, in predict
    return self.__proxy__.predict(dataset, options)
  File "/Users/henry/Desktop/turicreate/release/src/python/turicreate/extensions.py", line 290, in <lambda>
    ret = lambda *args, **kwargs: self.__run_class_function(name, args, kwargs)
  File "/Users/henry/Desktop/turicreate/release/src/python/turicreate/extensions.py", line 277, in __run_class_function
    raise _ToolkitError(exc)
turicreate.toolkits._main.ToolkitError: Annotations column must be of type dict or list

Basically the predict function show only depends on the image column :)))))).

@guihao-liang
Copy link
Collaborator

change it into p2. It won't crash the program.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
3 participants