Update sample
Browse files
sample
CHANGED
|
@@ -1,98 +1,114 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
-
Totals:
|
| 11 |
-
- N = 17277
|
| 12 |
-
- C = 7
|
| 13 |
|
| 14 |
-
Formula (inverse-frequency, mean-normalized):
|
| 15 |
-
1) Raw weight: w_i_raw = N / (C * count_i)
|
| 16 |
-
2) Normalize: w_i = w_i_raw / mean(w_raw)
|
| 17 |
-
|
| 18 |
-
Computed weights (class 0..6):
|
| 19 |
-
[0.189313, 0.312012, 1.356881, 2.309691, 0.639101, 0.517706, 1.675296]
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
### Check No of faces
|
| 27 |
-
|
| 28 |
-
# compare_step_faces.py
|
| 29 |
-
from OCC.Core.STEPControl import STEPControl_Reader
|
| 30 |
-
from OCC.Core.IFSelect import IFSelect_RetDone
|
| 31 |
-
from OCC.Core.TopExp import TopExp_Explorer
|
| 32 |
-
from OCC.Core.TopAbs import TopAbs_FACE
|
| 33 |
-
from OCC.Core.TopoDS import topods
|
| 34 |
-
|
| 35 |
-
try:
|
| 36 |
-
# pythonocc (common) helper
|
| 37 |
-
from OCC.Extend.TopologyUtils import TopologyExplorer
|
| 38 |
-
except Exception as e:
|
| 39 |
-
TopologyExplorer = None
|
| 40 |
-
|
| 41 |
-
from occwl.io import load_step
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
def _load_shape_stepcontrol(step_path: str):
|
| 45 |
-
reader = STEPControl_Reader()
|
| 46 |
-
status = reader.ReadFile(step_path)
|
| 47 |
-
if status != IFSelect_RetDone:
|
| 48 |
-
raise RuntimeError(f"STEP read failed: status={status}")
|
| 49 |
-
reader.TransferRoots()
|
| 50 |
-
shape = reader.OneShape()
|
| 51 |
-
return shape
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
def count_faces_method1(step_path: str) -> int:
|
| 55 |
-
if TopologyExplorer is None:
|
| 56 |
-
raise RuntimeError("TopologyExplorer not available. Check pythonocc installation.")
|
| 57 |
-
shape = _load_shape_stepcontrol(step_path)
|
| 58 |
-
top_exp = TopologyExplorer(shape, ignore_orientation=True)
|
| 59 |
-
faces = [f for f in top_exp.faces()]
|
| 60 |
-
return len(faces)
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
def count_faces_method2(step_path: str) -> int:
|
| 64 |
-
shape = _load_shape_stepcontrol(step_path)
|
| 65 |
-
explorer = TopExp_Explorer(shape, TopAbs_FACE)
|
| 66 |
-
count = 0
|
| 67 |
-
while explorer.More():
|
| 68 |
-
_face = topods.Face(explorer.Current())
|
| 69 |
-
count += 1
|
| 70 |
-
explorer.Next()
|
| 71 |
-
return count
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
def count_faces_method3(step_path: str) -> int:
|
| 75 |
-
solids = load_step(step_path)
|
| 76 |
-
if len(solids) != 1:
|
| 77 |
-
raise RuntimeError(f"Expected 1 solid, got {len(solids)}")
|
| 78 |
-
solid = solids[0]
|
| 79 |
-
faces = [f for f in solid.faces()]
|
| 80 |
-
return len(faces)
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
def compare_counts(step_path: str):
|
| 84 |
-
m1 = count_faces_method1(step_path)
|
| 85 |
-
m2 = count_faces_method2(step_path)
|
| 86 |
-
m3 = count_faces_method3(step_path)
|
| 87 |
-
|
| 88 |
-
print(f"Method 1 (TopologyExplorer): {m1}")
|
| 89 |
-
print(f"Method 2 (TopExp_Explorer): {m2}")
|
| 90 |
-
print(f"Method 3 (occwl load_step): {m3}")
|
| 91 |
-
|
| 92 |
-
all_same = (m1 == m2 == m3)
|
| 93 |
-
print(f"All methods match: {all_same}")
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
if __name__ == "__main__":
|
| 97 |
-
step_path = r"C:\Users\FCI\Desktop\0m-3623639.stp"
|
| 98 |
-
compare_counts(step_path)
|
|
|
|
| 1 |
+
train accuracy
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
Testing DataLoader 0: 100% 590/590 [00:18<00:00, 32.52it/s]num_classes: 7
|
| 5 |
+
per_face_accuracy: 0.5899062178131945
|
| 6 |
+
class_1_acc: 0.5705482698688576
|
| 7 |
+
class_2_acc: 0.9057858567945023
|
| 8 |
+
class_3_acc: 0.33861834654586637
|
| 9 |
+
class_4_acc: 0.3665283540802213
|
| 10 |
+
class_5_acc: 0.4549301735082522
|
| 11 |
+
class_6_acc: 0.4173469387755102
|
| 12 |
+
class_7_acc: 0.45702005730659023
|
| 13 |
+
per_class_accuracy: 0.5015397138399714
|
| 14 |
+
IoU: 0.33042782010594945
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
test_accuracy
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
Testing DataLoader 0: 100% 72/72 [00:03<00:00, 18.58it/s]num_classes: 7
|
| 29 |
+
per_face_accuracy: 0.5375796178343949
|
| 30 |
+
class_1_acc: 0.5367647058823529
|
| 31 |
+
class_2_acc: 0.9249146757679181
|
| 32 |
+
class_3_acc: 0.09885931558935361
|
| 33 |
+
class_4_acc: 0.29896907216494845
|
| 34 |
+
class_5_acc: 0.36097560975609755
|
| 35 |
+
class_6_acc: 0.384
|
| 36 |
+
class_7_acc: 0.4420289855072464
|
| 37 |
+
per_class_accuracy: 0.43521605209541675
|
| 38 |
+
IoU: 0.2786472821122044
|
| 39 |
+
per_file_accuracy:
|
| 40 |
+
file_id_691: 0.46153849363327026
|
| 41 |
+
file_id_679: 0.7272727489471436
|
| 42 |
+
file_id_719: 0.25
|
| 43 |
+
file_id_666: 0.4399999976158142
|
| 44 |
+
file_id_696: 0.4166666865348816
|
| 45 |
+
file_id_675: 0.3055555522441864
|
| 46 |
+
file_id_706: 0.6341463327407837
|
| 47 |
+
file_id_723: 0.7045454978942871
|
| 48 |
+
file_id_699: 0.884615421295166
|
| 49 |
+
file_id_710: 0.5
|
| 50 |
+
file_id_731: 0.6666666865348816
|
| 51 |
+
file_id_707: 0.6666666865348816
|
| 52 |
+
file_id_672: 0.6875
|
| 53 |
+
file_id_727: 0.5
|
| 54 |
+
file_id_703: 0.52173912525177
|
| 55 |
+
file_id_716: 0.41999998688697815
|
| 56 |
+
file_id_717: 0.9677419066429138
|
| 57 |
+
file_id_704: 0.9259259104728699
|
| 58 |
+
file_id_700: 0.8333333730697632
|
| 59 |
+
file_id_724: 0.4000000059604645
|
| 60 |
+
file_id_729: 0.75
|
| 61 |
+
file_id_725: 0.71875
|
| 62 |
+
file_id_713: 0.5
|
| 63 |
+
file_id_730: 0.75
|
| 64 |
+
file_id_684: 0.5333333611488342
|
| 65 |
+
file_id_690: 0.7058823704719543
|
| 66 |
+
file_id_728: 0.04838709533214569
|
| 67 |
+
file_id_732: 0.9166666865348816
|
| 68 |
+
file_id_698: 0.6666666865348816
|
| 69 |
+
file_id_674: 0.6315789222717285
|
| 70 |
+
file_id_726: 0.8076923489570618
|
| 71 |
+
file_id_693: 0.5
|
| 72 |
+
file_id_662: 0.9166666865348816
|
| 73 |
+
file_id_677: 0.78125
|
| 74 |
+
file_id_692: 0.6666666865348816
|
| 75 |
+
file_id_708: 0.6363636255264282
|
| 76 |
+
file_id_686: 0.575757622718811
|
| 77 |
+
file_id_685: 0.7692307829856873
|
| 78 |
+
file_id_667: 0.31481480598449707
|
| 79 |
+
file_id_701: 0.375
|
| 80 |
+
file_id_715: 0.5909091234207153
|
| 81 |
+
file_id_733: 0.20370370149612427
|
| 82 |
+
file_id_712: 0.4523809552192688
|
| 83 |
+
file_id_678: 0.6666666865348816
|
| 84 |
+
file_id_689: 0.6000000238418579
|
| 85 |
+
file_id_670: 1.0
|
| 86 |
+
file_id_687: 0.7333333492279053
|
| 87 |
+
file_id_711: 0.3658536374568939
|
| 88 |
+
file_id_681: 0.45000001788139343
|
| 89 |
+
file_id_668: 0.8636363744735718
|
| 90 |
+
file_id_694: 0.28125
|
| 91 |
+
file_id_671: 0.944444477558136
|
| 92 |
+
file_id_714: 0.699999988079071
|
| 93 |
+
file_id_722: 0.6363636255264282
|
| 94 |
+
file_id_669: 0.523809552192688
|
| 95 |
+
file_id_709: 0.21052631735801697
|
| 96 |
+
file_id_688: 0.28947368264198303
|
| 97 |
+
file_id_683: 0.65625
|
| 98 |
+
file_id_697: 0.5
|
| 99 |
+
file_id_676: 0.53125
|
| 100 |
+
file_id_682: 0.1666666716337204
|
| 101 |
+
file_id_702: 0.4599999785423279
|
| 102 |
+
file_id_680: 0.41379308700561523
|
| 103 |
+
file_id_665: 0.692307710647583
|
| 104 |
+
file_id_695: 0.5625
|
| 105 |
+
file_id_718: 0.5
|
| 106 |
+
file_id_721: 0.8125
|
| 107 |
+
file_id_673: 0.8125
|
| 108 |
+
file_id_664: 0.42500001192092896
|
| 109 |
+
file_id_720: 0.8333333730697632
|
| 110 |
+
file_id_663: 0.7333333492279053
|
| 111 |
+
file_id_705: 0.3863636553287506
|
| 112 |
+
Testing DataLoader 0: 100% 72/72
|
| 113 |
|
|
|
|
|
|
|
|
|
|
| 114 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|