benjaminStreltzin commited on
Commit
fa80d4b
·
verified ·
1 Parent(s): 1310ac0

Update vit_Training.py

Browse files
Files changed (1) hide show
  1. vit_Training.py +17 -18
vit_Training.py CHANGED
@@ -64,25 +64,24 @@ class Custom_VIT_Model:
64
  else:
65
  self.df = pd.DataFrame(columns=['image_path', 'label'])
66
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
 
68
- def add_data(self, image_path: str, label: int):
69
- # Create a new DataFrame entry
70
- new_entry = pd.DataFrame({'image_path': [image_path], 'label': [label]})
71
-
72
- # Append the new entry to the existing DataFrame
73
- self.df = pd.concat([self.df, new_entry], ignore_index=True)
74
-
75
- # Save the updated DataFrame to the specified CSV file
76
- self.df.to_csv(self.data_file, index=False)
77
-
78
- # Print the current state of the training data for debugging
79
- print("Current training data:")
80
- print(self.df)
81
-
82
- # Check if we have 100 images for retraining
83
- if len(self.df) >= 100:
84
- print("Retraining the model as we have enough data.")
85
- self.retrain_model()
86
 
87
 
88
 
 
64
  else:
65
  self.df = pd.DataFrame(columns=['image_path', 'label'])
66
 
67
+ def add_data(self, image_path: str, label: int):
68
+ # Create a new DataFrame entry
69
+ new_entry = pd.DataFrame({'image_path': [image_path], 'label': [label]})
70
+
71
+ # Append the new entry to the existing DataFrame
72
+ self.df = pd.concat([self.df, new_entry], ignore_index=True)
73
+
74
+ # Save the updated DataFrame to the specified CSV file
75
+ self.df.to_csv(self.data_file, index=False)
76
+
77
+ # Print the current state of the training data for debugging
78
+ print("Current training data:")
79
+ print(self.df)
80
 
81
+ # Check if we have 100 images for retraining
82
+ if len(self.df) >= 100:
83
+ print("Retraining the model as we have enough data.")
84
+ self.retrain_model()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
 
86
 
87