-
Notifications
You must be signed in to change notification settings - Fork 18
Yolo output #1320
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Yolo output #1320
Conversation
mzur
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still doubtful if AI generated code like this makes us really more productive but I'll try to go along.
How does this handle the separateLabelTrees, separateUsers, newestLabel and onlyLabels options that all other report types support?
I skipped a few files which I'll review next time (for the most part the Python script). More comments below.
| public function getOptions() | ||
| { | ||
| return array_merge(parent::getOptions(), [ | ||
| \Log::info('StoreVolumeReport input:', $this->all()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't use Log anywhere. We only log exceptions and that's done automatically.
| 'yolo_image_path' => 'nullable|string', | ||
| 'yolo_split_ratio' => 'nullable|string|regex:/^\d+(\.\d+)? \d+(\.\d+)? \d+(\.\d+)?$/', | ||
| ]); | ||
| } | ||
|
|
||
| /** | ||
| * Get the options for the new report. | ||
| * | ||
| * @return array | ||
| */ | ||
| public function getOptions() | ||
| { | ||
| return array_merge(parent::getOptions(), [ | ||
| 'yoloImagePath' => $this->input('yolo_image_path'), | ||
| 'yoloSplitRatio' => $this->input('yolo_split_ratio'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add this to the StoreReport class. There you also see that options are only set for the appropriate report type. Like this it would be added to any report.
| 'yolo_image_path' => 'nullable|string', | ||
| 'yolo_split_ratio' => 'nullable|string|regex:/^\d+(\.\d+)? \d+(\.\d+)? \d+(\.\d+)?$/', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above.
| 'yoloImagePath' => $this->input('yolo_image_path'), | ||
| 'yoloSplitRatio' => $this->input('yolo_split_ratio'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above.
| return array_merge(parent::rules(), [ | ||
| 'type_id' => 'required|integer|exists:report_types,id', | ||
| 'yolo_image_path' => 'nullable|string', | ||
| 'yolo_split_ratio' => 'nullable|string|regex:/^\d+(\.\d+)? \d+(\.\d+)? \d+(\.\d+)?$/', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not store the split ratio in 3 different variables? No joining/splitting and complicated validation needed.
| <div class="checkbox"> | ||
| <label> | ||
| <input type="checkbox" v-model="options.separate_label_trees"> Separate label trees | ||
| <label :class="{'text-muted': options.separate_users}"> | ||
| <input type="checkbox" v-model="options.separate_label_trees" :disabled="options.separate_users"> Separate label trees | ||
| </label> | ||
| </div> | ||
| </div> | ||
| <div class="col-xs-6"> | ||
| <div class="checkbox"> | ||
| <label> | ||
| <input type="checkbox" v-model="options.separate_users"> Separate users | ||
| <label :class="{'text-muted': options.separate_label_trees}"> | ||
| <input type="checkbox" v-model="options.separate_users" :disabled="options.separate_label_trees"> Separate users |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is unrelated to this PR.
| <label> | ||
| <input type="checkbox" v-model="options.separate_label_trees"> Separate label trees | ||
| <label :class="{'text-muted': options.separate_users}"> | ||
| <input type="checkbox" v-model="options.separate_label_trees" :disabled="options.separate_users"> Separate label trees | ||
| </label> | ||
| </div> | ||
| </div> | ||
| <div class="col-xs-6"> | ||
| <div class="checkbox"> | ||
| <label> | ||
| <input type="checkbox" v-model="options.separate_users"> Separate users | ||
| <label :class="{'text-muted': options.separate_label_trees}"> | ||
| <input type="checkbox" v-model="options.separate_users" :disabled="options.separate_label_trees"> Separate users |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same.
| public function testOptionsAreStored() | ||
| { | ||
| $generator = new YoloReportGenerator([ | ||
| 'yoloImagePath' => '/custom/path', | ||
| 'yoloSplitRatio' => '0.6 0.3 0.1', | ||
| ]); | ||
|
|
||
| $this->assertEquals('/custom/path', $generator->options->get('yoloImagePath')); | ||
| $this->assertEquals('0.6 0.3 0.1', $generator->options->get('yoloSplitRatio')); | ||
| } | ||
|
|
||
| public function testDefaultOptions() | ||
| { | ||
| $generator = new YoloReportGenerator(); | ||
|
|
||
| $this->assertEquals('', $generator->options->get('yoloImagePath', '')); | ||
| $this->assertEquals('0.7 0.2 0.1', $generator->options->get('yoloSplitRatio', '0.7 0.2 0.1')); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These tests are not really useful.
| protected function makeZip($files, $path) | ||
| { | ||
| // Use mocked ZipArchive but skip actual file operations | ||
| $zip = App::make(ZipArchive::class); | ||
| $open = $zip->open($path, ZipArchive::OVERWRITE); | ||
| if ($open !== true) { | ||
| throw new \Exception("Could not open ZIP file '{$path}'."); | ||
| } | ||
| $zip->close(); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for this because the mock is already defined in the test method.
| public function getCsvCount() | ||
| { | ||
| // Count how many CSVs would be created | ||
| $rows = $this->query()->get(); | ||
|
|
||
| // YOLO always creates a single CSV, regardless of separation options | ||
| $this->csvCount = 1; | ||
|
|
||
| return $this->csvCount; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use $this->assertEquals(1, 1) directly? 😄
Yolo output almost analog to coco output