Skip to content

Commit 96418ea

Browse files
committed
training tweaks
1 parent 336f572 commit 96418ea

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

roboflow/core/project.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -209,11 +209,11 @@ def train(
209209

210210
new_version = self.generate_version(settings=new_version_settings)
211211
new_version = self.version(new_version)
212-
new_version.train(
212+
new_model = new_version.train(
213213
speed=speed, checkpoint=checkpoint, plot_in_notebook=plot_in_notebook
214214
)
215215

216-
return True
216+
return new_model
217217

218218
def version(self, version_number, local=None):
219219
"""Retrieves information about a specific version, and throws it into an object.
@@ -348,7 +348,7 @@ def __annotation_upload(self, annotation_path, image_id):
348348
annotation_string = open(annotation_path, "r").read()
349349
# Set annotation upload url
350350

351-
project_name = self.id.rsplit("/")[1]
351+
project_name = self.id.rsplit("/")[1]
352352

353353
self.annotation_upload_url = "".join(
354354
[
@@ -528,14 +528,18 @@ def single_upload(
528528
if "success" in response_data.keys():
529529
annotation_success = True
530530
elif "error" in response_data.keys():
531-
warnings.warn(f"Uploading annotation data for image failed: {str(response_data['error'])}")
531+
warnings.warn(
532+
f"Uploading annotation data for image failed: {str(response_data['error'])}"
533+
)
532534
annotation_success = False
533535
else:
534-
warnings.warn(f"Uploading annotation data for image failed: {str(response_data)}")
535-
annotation_success = False
536+
warnings.warn(
537+
f"Uploading annotation data for image failed: {str(response_data)}"
538+
)
539+
annotation_success = False
536540
except:
537541
warnings.warn(f"Bad response: {response.status_code}")
538-
annotation_success = False
542+
annotation_success = False
539543

540544
# Give user warning that annotation failed to upload
541545
if not annotation_success:

roboflow/core/version.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ def live_plot(epochs, mAP, loss, title=""):
349349
previous_epochs = []
350350
num_machine_spin_dots = []
351351

352-
while status == "training":
352+
while status == "training" or status == "running":
353353
url = (
354354
f"{API_URL}/{self.workspace}/{self.project}/{self.version}?nocache=true"
355355
)
@@ -366,8 +366,7 @@ def live_plot(epochs, mAP, loss, title=""):
366366
status = "finished"
367367
break
368368
if "status" in version["train"].keys():
369-
status = version["train"]["status"]
370-
if status == "failed":
369+
if version["train"]["status"] == "failed":
371370
write_line(line="Training failed")
372371
break
373372

@@ -396,7 +395,7 @@ def live_plot(epochs, mAP, loss, title=""):
396395
]
397396
)
398397

399-
title = "Training in Progress: "
398+
title = "Training in Progress"
400399
# plottling logic
401400
else:
402401
num_machine_spin_dots.append(".")
@@ -415,7 +414,7 @@ def live_plot(epochs, mAP, loss, title=""):
415414
if len(epochs) > 0:
416415
title = (
417416
title
418-
+ " Epoch: "
417+
+ ": Epoch: "
419418
+ str(epochs[-1])
420419
+ " mAP: "
421420
+ str(mAP[-1])

0 commit comments

Comments
 (0)